saealib.PerObjectiveSurrogate#

class saealib.PerObjectiveSurrogate(surrogates)[ソース]#

ベースクラス: RegressionSurrogate

Assigns a different surrogate model to each objective function.

Each surrogate in surrogates is fitted on the corresponding column of train_y. Predictions are concatenated along the objective axis.

If every surrogate has provides_uncertainty = True, the returned SurrogatePrediction.std is populated by stacking each surrogate's std output; otherwise std is None.

パラメータ:

surrogates (list[Surrogate]) -- One surrogate per objective. Must be non-empty.

例外:

ValueError -- If surrogates is empty, or if the number of objectives in train_y does not match len(surrogates) at fit time.

Methods

__init__

contract

Return the surrogate model contract.

fit

Fit each surrogate on its corresponding objective column.

post_fit

Post-fit lifecycle hook; override to inject custom processing.

predict

Predict by combining each surrogate's output.

with_post_fit

Return a copy of this surrogate with fn appended to the post-fit hook.

Method Details

PerObjectiveSurrogate.__init__(surrogates)[ソース]#
パラメータ:

surrogates (list[Surrogate])

戻り値の型:

None

PerObjectiveSurrogate.contract()#

Return the surrogate model contract.

戻り値の型:

ComponentContract

PerObjectiveSurrogate.fit(train_x, train_y)[ソース]#

Fit each surrogate on its corresponding objective column.

パラメータ:
  • 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,).

戻り値の型:

None

PerObjectiveSurrogate.post_fit(train_x, train_y, ctx=None)#

Post-fit lifecycle hook; override to inject custom processing.

パラメータ:
  • 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.

戻り値の型:

None

PerObjectiveSurrogate.predict(test_x)[ソース]#

Predict by combining each surrogate's output.

パラメータ:

test_x (np.ndarray) -- Input data. shape: (n_samples, n_features) or (n_features,)

戻り値:

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_x regardless of whether the wrapped surrogates populate their own x (needed by acquisition functions such as CORSDistance).

戻り値の型:

SurrogatePrediction

PerObjectiveSurrogate.with_post_fit(fn)#

Return a copy of this surrogate with fn appended to the post-fit hook.

パラメータ:

fn (callable) -- fn(train_x, train_y, ctx) -> None

戻り値:

Shallow copy with the hook registered.

戻り値の型:

Surrogate