tricands.tricands.tricands
tricands.tricands.tricands(
X,
p=0.5,
fringe=True,
nmax=None,
best=None,
ordering=None,
vis=False,
imgname='tricands.pdf',
lower=0,
upper=1,
)
Generate Triangulation Candidates for Bayesian Optimization. Assumes a bounding box of [lower, upper]^m.
Parameters
| X |
np.ndarray |
Design matrix of shape (n_samples, n_features). Each row gives a design point and each column a feature. |
required |
| p |
float |
Distance to the boundary for fringe candidates (0 = on hull, 1 = on boundary). Defaults to 0.5. |
0.5 |
| fringe |
bool |
Whether to include fringe points to allow exploration outside the convex hull. Defaults to True. |
True |
| nmax |
int |
Maximum size of candidate set. If output exceeds this, strategic subsetting is employed. Defaults to 100 * n_features. |
None |
| best |
int |
Index of the best (lowest) currently observed point. Used for strategic subsetting in Bayesian optimization. Defaults to None. |
None |
| ordering |
np.ndarray |
Order of closeness of rows of X to a contour level. Used for contour location subsetting. Defaults to None. |
None |
| vis |
bool |
Whether to visualize the triangulation. Only applicable to 2D designs. Defaults to False. |
False |
| imgname |
str |
File name for saved plot if vis=True. Defaults to ‘tricands.pdf’. |
'tricands.pdf' |
| lower |
float |
Lower bound of bounding box for all dimensions. Defaults to 0. |
0 |
| upper |
float |
Upper bound of bounding box for all dimensions. Defaults to 1. |
1 |
Returns
|
np.ndarray |
np.ndarray: Array of candidate points, shape (n_candidates, n_features). |
Raises
|
Exception |
If visualization is requested for non-2D data. |
|
Exception |
If number of points is less than n_features + 1. |
|
Exception |
If both ‘best’ and ‘ordering’ are provided. |
|
Exception |
If X contains values outside [lower, upper]. |
Examples
>>> import numpy as np
>>> from spotoptim.tricands import tricands
>>> X = np.array([[0.1, 0.1], [0.9, 0.1], [0.5, 0.9], [0.2, 0.5]])
>>> candidates = tricands(X, fringe=True, p=0.5)
>>> print(candidates.shape)
(7, 2)