Back to models
Transformer

TabularToSeriesAdaptor

Adapt scikit-learn transformation interface to time series setting.

Quickstart

python
from sktime.transformations.adapt import TabularToSeriesAdaptor

estimator = TabularToSeriesAdaptor(transformer, fit_in_transform=False, pass_y='auto', input_type=None, pooling='local')

Parameters(5)

transformersklearn transformer, BaseEstimator descendant instance
scikit-learn-like transformer to fit and apply to series. This is used as a “blueprint” and not fitted or otherwise mutated.
fit_in_transform: bool, optional, default=False

whether transformer_ should be fitted in transform (True), or in fit (False).

  • recommended setting in forecasting (single series or hierarchical): False

  • recommended setting in ts classification, regression, clustering: True

pass_ystr, optional, one of “auto” (default), “fit”, “always”, “never”

Whether to pass y to transformer methods of the transformer clone.

  • “auto”: passes y to methods fit, transform, fit_transform, inverse_transform, if and only if y is a named arg of either method without default. Note: passes y even if it is None

  • “fit”: passes y to method fit, but not to transform. Note: passes y even if it is None, or if not a named arg

  • “always”: passes y to all methods, fit, transform, inverse_transform. Note: passes y even if it is None, or if not a named arg

  • “never”: never passes y to any method.

input_typestr, one of “numpy” (default), “pandas”, optional

type of data passed to the sklearn transformer

  • “numpy”: 2D np.ndarray

  • “pandas”: pd.DataFrame, with column names passed to transformer. column names are coerced to strings if not already, row index is reset to RangeIndex.

poolingstr, one of “local” (default), “global”

whether to apply transformer to each series individually (local), or to all series at once (global)

  • “local”: applies transformer to each series individually

  • “global”: applies transformer to all series at once, pooled to a single 2D np.ndarray or pd.DataFrame

Examples

>>> from sktime.transformations.adapt import TabularToSeriesAdaptor
>>> from sklearn.preprocessing import MinMaxScaler
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> transformer = TabularToSeriesAdaptor (MinMaxScaler ())
>>> y_hat = transformer. fit_transform (y)