saealib.PerObjectiveSurrogate#
- class saealib.PerObjectiveSurrogate(surrogates)[source]#
Bases:
RegressionSurrogateAssigns a different surrogate model to each objective function.
Each surrogate in
surrogatesis fitted on the corresponding column oftrain_y. Predictions are concatenated along the objective axis.If every surrogate has
provides_uncertainty = True, the returnedSurrogatePrediction.stdis populated by stacking each surrogate’sstdoutput; otherwisestdisNone.- Parameters:
surrogates (list[Surrogate]) – One surrogate per objective. Must be non-empty.
- Raises:
ValueError – If
surrogatesis empty, or if the number of objectives intrain_ydoes not matchlen(surrogates)at fit time.
Methods
Return the surrogate model contract. |
|
Fit each surrogate on its corresponding objective column. |
|
Post-fit lifecycle hook; override to inject custom processing. |
|
Predict by combining each surrogate's output. |
|
Return a copy of this surrogate with |
Method Details
- PerObjectiveSurrogate.__init__(surrogates)[source]#
- Parameters:
surrogates (list[Surrogate])
- Return type:
None
- PerObjectiveSurrogate.contract()#
Return the surrogate model contract.
- Return type:
- PerObjectiveSurrogate.fit(train_x, train_y)[source]#
Fit each surrogate on its corresponding objective column.
- 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
- PerObjectiveSurrogate.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
- PerObjectiveSurrogate.predict(test_x)[source]#
Predict by combining each surrogate’s output.
- Parameters:
test_x (np.ndarray) – Input data. shape: (n_samples, n_features) or (n_features,)
- Returns:
prediction.value shape: (n_samples, n_obj) prediction.std shape: (n_samples, n_obj) if all surrogates provide uncertainty, otherwise None. prediction.x holds the (n_samples, n_features) query points passed to this call, set directly from
test_xregardless of whether the wrapped surrogates populate their ownx(needed by acquisition functions such as CORSDistance).- Return type: