saealib.SklearnSurrogate#
- class saealib.SklearnSurrogate(estimator)[source]#
Bases:
RegressionSurrogateSurrogate adapter for scikit-learn compatible estimators.
Wraps any estimator that implements
fit(X, y)andpredict(X). Multi-objective problems are handled by fitting one cloned estimator per objective, following the same pattern asRBFSurrogate.- Parameters:
estimator (sklearn estimator) – A scikit-learn compatible regressor instance (e.g.
SVR()). The estimator is cloned once per objective on the firstfitcall.- Raises:
ImportError – If scikit-learn is not installed.
Methods
Return the surrogate model contract. |
|
Fit the surrogate model. |
|
Post-fit lifecycle hook; override to inject custom processing. |
|
Predict using the surrogate model. |
|
Return a copy of this surrogate with |
Method Details
- SklearnSurrogate.contract()#
Return the surrogate model contract.
- Return type:
- SklearnSurrogate.fit(train_x, train_y)[source]#
Fit the surrogate model.
- Parameters:
train_x (np.ndarray) – Training input data. shape: (n_samples, n_features)
train_y (np.ndarray) – Training output data. shape: (n_samples, n_obj) or (n_samples,).
- Return type:
None
- SklearnSurrogate.post_fit(train_x, train_y, ctx=None)#
Post-fit lifecycle hook; override to inject custom processing.
- Parameters:
train_x (np.ndarray) – Training input data used for this fit. shape: (n_samples, n_features)
train_y (np.ndarray) – Training output data used for this fit. shape: (n_samples, n_obj)
ctx (OptimizationState or None, optional) – Current optimization context.
- Return type:
None