Developer API for sampling methods

SamplingMethod

A base class for all sampling methods in SMT.

class smt.sampling_methods.sampling_method.SamplingMethod(**kwargs)[source]

Methods

__call__(nt)

Compute the requested number of sampling points.

_initialize(**kwargs) None[source]

Implemented by sampling methods to declare options and/or use these optional values for initialization (optional)

Parameters:
**kwargsnamed arguments passed by the user

Set of options that can be optionally set

Examples

self.options.declare(‘option_name’, default_value, types=(bool, int), desc=’description’)

abstract _compute(nt: int) ndarray[source]

Implemented by sampling methods to compute the requested number of sampling points.

The number of dimensions (nx) is determined based on xlimits.shape[0].

Returns:
ndarray[nt, nx]

The sampling locations in the input space.

ScaledSamplingMethod

Conveniently, if a sampling method generates samples in the [0, 1] hypercube, one can inherit from the subclass ScaledSamplingMethod which automates the scaling from unit hypercube to the input space (i.e. xlimits).

class smt.sampling_methods.sampling_method.ScaledSamplingMethod(**kwargs)[source]

This class describes an sample method which generates samples in the unit hypercube.

The __call__ method does scale the generated samples accordingly to the defined xlimits.

Methods

__call__(nt)

Compute the requested number of sampling points.

abstract _compute(nt: int) ndarray[source]

Implemented by sampling methods to compute the requested number of sampling points.

The number of dimensions (nx) is determined based on xlimits.shape[0].

Returns:
ndarray[nt, nx]

The sampling locations in the unit hypercube.