tempor.methods.preprocessing.scaling.temporal.plugin_ts_standard_scaler module

Standard scaling for the temporal data.

class tempor.methods.preprocessing.scaling.temporal.plugin_ts_standard_scaler.TimeSeriesStandardScalerParams(with_mean: bool = True, with_std: bool = True)[source]

Bases: object

Initialization parameters for TimeSeriesStandardScaler.

with_mean : bool = True

If True, center the data before scaling. See sklearn.preprocessing.StandardScaler.

with_std : bool = True

If True, scale the data to unit variance. See sklearn.preprocessing.StandardScaler.

class tempor.methods.preprocessing.scaling.temporal.plugin_ts_standard_scaler.TimeSeriesStandardScaler(**params: Any)[source]

Bases: BaseScaler

Standard scaling for the time-series data.

Standardize the temporal features by removing the mean and scaling to unit variance. The time series data will be represented as a multi-index (sample_idx, time_idx) dataframe of features, and the scaling will be applied to this dataframe.

Parameters:
**params : Any

Parameters and defaults as defined in TimeSeriesStandardScalerParams.

Example

>>> from tempor import plugin_loader
>>>
>>> dataset = plugin_loader.get("prediction.one_off.sine", plugin_type="datasource").load()
>>>
>>> # Load the model:
>>> model = plugin_loader.get("preprocessing.scaling.temporal.ts_standard_scaler")
>>>
>>> # Train:
>>> model.fit(dataset)
TimeSeriesStandardScaler(...)
>>>
>>> # Scale:
>>> scaled = model.transform(dataset)
ParamsDefinition

alias of TimeSeriesStandardScalerParams

params : TimeSeriesStandardScalerParams
category : ClassVar[plugin_typing.PluginCategory] = 'preprocessing.scaling.temporal'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[plugin_typing.PluginName] = 'ts_standard_scaler'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[plugin_typing.PluginTypeArg] = 'method'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

static hyperparameter_space(*args: Any, **kwargs: Any) list[Params][source]

The hyperparameter search domain, used for tuning.

Can provide variadics *args and **kwargs, these will be received from sample_hyperparameters.