Sampling methods¶
SMT contains a library of sampling methods used to generate sets of points in the input space, either for training or for prediction. These are listed below.
Usage¶
import numpy as np
import matplotlib.pyplot as plt
from smt.sampling_methods import Random
xlimits = np.array([[0.0, 4.0], [0.0, 3.0]])
sampling = Random(xlimits=xlimits)
num = 50
x = sampling(num)
print(x.shape)
plt.plot(x[:, 0], x[:, 1], "o")
plt.xlabel("x")
plt.ylabel("y")
plt.show()
(50, 2)
Problem class API¶
- class smt.sampling_methods.sampling_method.SamplingMethod(**kwargs)[source]¶
Methods
__call__
(nt)Compute the requested number of sampling points.
- __init__(**kwargs)[source]¶
Constructor where values of options can be passed in.
For the list of options, see the documentation for the problem being used.
- Parameters
- **kwargsnamed arguments
Set of options that can be optionally set; each option must have been declared.
Examples
>>> import numpy as np >>> from smt.sampling_methods import Random >>> sampling = Random(xlimits=np.arange(2).reshape((1, 2)))