tempor.methods.preprocessing.imputation.temporal.plugin_bfill module

Implementation using bfill.

class tempor.methods.preprocessing.imputation.temporal.plugin_bfill.BFillImputer(**params: Any)[source]

Bases: BaseImputer

Backward-first Time-Series Imputation.

Parameters:
**params : Any

Additional parameters.

Note

The data will be represented as a multi-index (sample_idx, time_idx) dataframe of features. Then bfill, ffill and fillna(0.0)` will be called in that order.

Example

>>> from tempor import plugin_loader
>>>
>>> dataset = plugin_loader.get(
...     "prediction.one_off.sine",
...     plugin_type="datasource",
...     with_missing=True,
... ).load()
>>> assert dataset.time_series.dataframe().isna().sum().sum() != 0
>>>
>>> # Load the model:
>>> model = plugin_loader.get("preprocessing.imputation.temporal.bfill")
>>>
>>> # Train:
>>> model.fit(dataset)
BFillImputer(...)
>>>
>>> # Impute:
>>> imputed = model.transform(dataset)
>>> assert imputed.time_series.dataframe().isna().sum().sum() == 0
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.

category : ClassVar[plugin_typing.PluginCategory] = 'preprocessing.imputation.temporal'

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

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

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.