A scikit-learn compatible Kriging model class for regression tasks.
This class provides Ordinary Kriging with support for: - Mixed variable types (continuous, integer, factor) - Gaussian/RBF correlation function - Three fitting methods (Forrester (2008), Section 6): - Isotropic or anisotropic length scales
Compatible with SpotOptim’s variable type conventions: - ‘float’: continuous numeric variables - ‘int’: integer variables - ‘factor’: categorical/unordered variables
Small regularization term for numerical stability (nugget effect). If None, defaults to sqrt(machine epsilon). Only used for “interpolation” method. For “regression” and “reinterpolation”, this is replaced by the Lambda parameter. Defaults to None.
Fitting method (Forrester (2008), Section 6). Options: - “interpolation”: Pure Kriging interpolation (Eq 2.X). Fits exact data points. Uses a small noise (nugget) for numerical stability. - “regression”: Regression Kriging (Section 6.2). Optimizes a regularization parameter Lambda (nugget) along with theta. Suitable for noisy data. - “reinterpolation”: Re-interpolation (Section 6.3). Fits hyperparameters using regression (with Lambda), but predicts using the “noise-free” correlation matrix (removing Lambda). This creates a surrogate that glosses over noise but passes closer to the underlying trend (interpolating the regression model). Defaults to “regression”.
Search parametrization of the nugget Lambda within [10min_Lambda, 10max_Lambda]. Options: - “log10”: the optimizer searches the exponent log10(Lambda) uniformly, emphasizing small nuggets (near-interpolation). - “linear”: the optimizer searches Lambda itself uniformly, emphasizing larger nuggets (more smoothing on noisy data). Defaults to “log10”.
Distance metric for factor variables. Defaults to "hamming". Hamming is a true nominal (order-agnostic) metric; canberra distance on integer level indices is order-dependent and singles out index 0. Any scipy distance metric remains selectable via this kwarg.
Optimized Lambda parameter in the search scale (the log10 exponent for lambda_scale="log10", the linear value for lambda_scale="linear") for regression methods.
>>>import numpy as np>>>from spotoptim.surrogate import Kriging>>> X = np.array([[0.], [1.]])>>> y = np.array([0., 1.])>>> k = Kriging(seed=42).fit(X, y)>>># Evaluate objective at optimal parameters>>> val = k.objective(np.concatenate([k.theta_, [k.Lambda_]]))