tempor.methods.preprocessing.imputation.temporal.plugin_ts_tabular_imputer module

Impute temporal covariates using any tabular imputer from the hyperimpute library.

class tempor.methods.preprocessing.imputation.temporal.plugin_ts_tabular_imputer.TemporalTabularImputerParams(imputer: typing_extensions.Literal[mean, missforest, EM, hyperimpute, sinkhorn, median, sklearn_missforest, miracle, softimpute, mice, gain, sklearn_ice, miwae, ice, most_frequent] = 'ice', random_state: int = 0, imputer_params: ~typing.Dict[str, ~typing.Any] = <factory>)[source]

Bases: object

Initialization parameters for TemporalTabularImputer.

imputer : Literal[mean] | Literal[missforest] | Literal[EM] | Literal[hyperimpute] | Literal[sinkhorn] | Literal[median] | Literal[sklearn_missforest] | Literal[miracle] | Literal[softimpute] | Literal[mice] | Literal[gain] | Literal[sklearn_ice] | Literal[miwae] | Literal[ice] | Literal[most_frequent] = 'ice'

Which imputer to use for temporal covariate imputation.

random_state : int = 0

Random seed. Will be passed on to the underlying imputer.

imputer_params : dict[str, Any]

Parameters to pass to the underlying imputer as a keyword arguments dictionary. Defaults to {}.

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

Bases: BaseImputer

Impute the temporal covariates using any tabular imputer from the hyperimpute library.

Note

The data will be represented as a multi-index (sample_idx, time_idx) dataframe of features, and the tabular imputer will be applied to this dataframe directly.

Parameters:
**params : Any

Parameters and defaults as defined in TemporalTabularImputerParams.

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.ts_tabular_imputer")
>>>
>>> # Train:
>>> model.fit(dataset)
TemporalTabularImputer(...)
>>>
>>> # Impute:
>>> imputed = model.transform(dataset)
>>> assert imputed.time_series.dataframe().isna().sum().sum() == 0
ParamsDefinition

alias of TemporalTabularImputerParams

params : TemporalTabularImputerParams
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] = 'ts_tabular_imputer'

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.