DefaultScaler

class baybe.scaler.DefaultScaler[source]

Bases: Scaler

A scaler that normalizes inputs to the unit cube and standardizes targets.

Public methods

__init__(searchspace)

fit_transform(x, y)

Fit the scaler using the given training data and transform the data.

transform(x)

Scale a given input.

untransform(mean, variance)

Transform mean values and variances back to the original domain.

Public attributes and properties

SUBCLASSES

Class variable for all subclasses

type

Class variable encoding the type of the scaler.

__init__(searchspace: DataFrame)
fit_transform(x: Tensor, y: Tensor)[source]

Fit the scaler using the given training data and transform the data.

Parameters:
  • x (Tensor) – The x-data that should be used.

  • y (Tensor) – The y-data that should be used.

Return type:

tuple[Tensor, Tensor]

Returns:

The transformed data.

transform(x: Tensor)

Scale a given input.

Parameters:

x (Tensor) – The given input.

Return type:

Tensor

Returns:

The scaled input.

Raises:

RuntimeError – If the scaler is not fitted first.

untransform(mean: Tensor, variance: Tensor)

Transform mean values and variances back to the original domain.

Parameters:
  • mean (Tensor) – The given mean values.

  • variance (Tensor) – The given variances.

Return type:

tuple[Tensor, Tensor]

Returns:

The “un-transformed” means and variances.

Raises:

RuntimeError – If the scaler object is not fitted first.

SUBCLASSES: dict[str, type[Scaler]] = {'DEFAULT': <class 'baybe.scaler.DefaultScaler'>}

Class variable for all subclasses

type: str = 'DEFAULT'

Class variable encoding the type of the scaler.