saealib.RegressionSurrogate#

class saealib.RegressionSurrogate[ソース]#

ベースクラス: Surrogate

Marker base class for absolute-fitness (regression) surrogates.

Subclass this when train_y represents real-valued objective outputs and predict().value is a continuous fitness estimate.

Methods

__init__

contract

Return the surrogate model contract.

fit

Fit the surrogate model.

post_fit

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

predict

Predict using the surrogate model.

with_post_fit

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

Method Details

RegressionSurrogate.__init__()#
RegressionSurrogate.contract()#

Return the surrogate model contract.

戻り値の型:

ComponentContract

abstractmethod RegressionSurrogate.fit(train_x, train_y)#

Fit the surrogate model.

パラメータ:
  • train_x (np.ndarray) -- Training input data. shape: (n_samples, n_features)

  • train_y (np.ndarray) -- Training output data. shape: (n_samples, n_obj) For n_obj == 1, shape (n_samples,) is also accepted.

戻り値の型:

None

RegressionSurrogate.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

abstractmethod RegressionSurrogate.predict(test_x)#

Predict using the surrogate model.

パラメータ:

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

戻り値:

prediction.value shape: (n_samples, n_obj) prediction.std shape: (n_samples, n_obj) or None

戻り値の型:

SurrogatePrediction

RegressionSurrogate.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