sampling.design.generate_collinear_design

sampling.design.generate_collinear_design(
    bounds,
    n_design,
    sigma=0.01,
    seed=None,
)

Generates a collinear design (poorly projected).

Currently implemented for 2D designs only. Generates points along a line with some Gaussian noise. The points are scaled to the provided bounds.

Parameters

Name Type Description Default
bounds Union[List[Tuple[float, float]], np.ndarray] Design space bounds. required
n_design int The number of points to generate. required
sigma float The standard deviation of the noise added to the y-coordinate (relative to unit scale). Defaults to 0.01. 0.01
seed Optional[Union[int, Generator]] Random seed or generator. None

Returns

Name Type Description
np.ndarray np.ndarray: A 2D array of shape (n_design, n_dim) with collinear points.

Raises

Name Type Description
ValueError If dimension is not 2.

Examples

>>> import numpy as np
>>> from spotoptim.sampling.design import generate_collinear_design
>>> bounds = [(0, 1), (0, 1)]
>>> X = generate_collinear_design(bounds, n_design=10, seed=42)
>>> X.shape
(10, 2)