baybe.surrogates.utils.autoscale

baybe.surrogates.utils.autoscale(cls: type[Surrogate])[source]

Make a Surrogate class automatically scale the domain it operates on.

More specifically, the modified class transforms its inputs before processing them and untransforms the results before returning them. The fitted scaler used for these transformations is stored in the class’ objects as an additional temporary attribute.

Parameters:

cls (type[Surrogate]) – The baybe.surrogates.base.Surrogate to be augmented.

Raises:

ValueError – If the class already contains an attribute with the same name as the temporary attribute to be added.

Returns:

The modified class.