surrogate.simple_kriging
surrogate.simple_kriging
Simplified SimpleKriging surrogate model for SpotOptim.
This is a streamlined version adapted from spotpython.surrogate.kriging for use with the SpotOptim optimizer.
Classes
SimpleKriging
A simplified Kriging (Gaussian Process) surrogate model for SpotOptim.
SimpleKriging
surrogate.simple_kriging.SimpleKriging(
noise= None ,
kernel= 'gauss' ,
n_theta= None ,
min_theta=- 3.0 ,
max_theta= 2.0 ,
seed= None ,
)
A simplified Kriging (Gaussian Process) surrogate model for SpotOptim.
This class provides a scikit-learn compatible interface with fit() and predict() methods, making it suitable for use as a surrogate in SpotOptim.
Parameters
noise
float
Regularization parameter (nugget effect). If None, uses sqrt(eps). Defaults to None.
None
kernel
str
Kernel type. Currently only ‘gauss’ (Gaussian/RBF) is supported. Defaults to ‘gauss’.
'gauss'
n_theta
int
Number of theta parameters. If None, uses k (number of dimensions). Defaults to None.
None
min_theta
float
Minimum log10(theta) bound for optimization. Defaults to -3.0.
-3.0
max_theta
float
Maximum log10(theta) bound for optimization. Defaults to 2.0.
2.0
seed
int
Random seed for reproducibility. Defaults to None.
None
Attributes
X_
ndarray
Training data, shape (n_samples, n_features).
y_
ndarray
Training targets, shape (n_samples,).
theta_
ndarray
Optimized theta parameters (log10 scale).
mu_
float
Mean of the SimpleKriging predictor.
sigma2_
float
Variance of the SimpleKriging predictor.
Examples
>>> import numpy as np
>>> from spotoptim.surrogate import SimpleKriging
>>> X = np.array([[0.0 ], [0.5 ], [1.0 ]])
>>> y = np.array([0.0 , 0.25 , 1.0 ])
>>> model = SimpleKriging()
>>> model.fit(X, y)
>>> predictions = model.predict(np.array([[0.25 ], [0.75 ]]))
Methods
fit
Fit the SimpleKriging model to training data.
predict
Predict using the SimpleKriging model.
fit
surrogate.simple_kriging.SimpleKriging.fit(X, y)
Fit the SimpleKriging model to training data.
Parameters
X
ndarray
Training input data, shape (n_samples, n_features).
required
y
ndarray
Training target values, shape (n_samples,).
required
predict
surrogate.simple_kriging.SimpleKriging.predict(X, return_std= False )
Predict using the SimpleKriging model.
Parameters
X
ndarray
Points to predict at, shape (n_samples, n_features).
required
return_std
bool
If True, return standard deviations as well. Defaults to False.
False
Returns
np .ndarray
ndarray or tuple: If return_std is False, returns predicted values (n_samples,). If return_std is True, returns tuple of (predictions, std_devs) both shape (n_samples,).