Introduction
¶

Data Type¶

Univariate Data¶

  • Series
In [4]:
from sktime.datasets import load_lynx
from sktime.utils.plotting import plot_series

y = load_lynx() # Series
plot_series(y)
Out[4]:
(<Figure size 1600x400 with 1 Axes>, <Axes: ylabel='Number of Lynx trappings'>)

Multivariate Data¶

  • DataFrame
In [3]:
from sktime.datasets import load_longley

y, X = load_longley() # X, DataFrame, y, Series

for column in X.columns:
    plot_series(X[column])

Panel Data¶

  • Multiple independent experiments, each of them have observations over time
In [4]:
from sktime.datasets import load_arrow_head
X, y = load_arrow_head() # X, DataFrame, 211*1, y, numpy array

from sktime.datatypes import convert
# 211*1*251
# 211 records, each record is a time-series data with 251 observations
X = convert(X, from_type = 'nested_univ', to_type = 'numpy3D') # X, numpy array
In [5]:
import numpy as np
labels, counts = np.unique(y, return_counts=True)
In [6]:
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)

for label in labels:
    ax.plot(X[y == label, 0, :][0])

Forecasting Horizon¶

In [4]:
import numpy as np
import pandas as pd
from sktime.forecasting.base import ForecastingHorizon

# relative forecast horizon
fh = np.arange(1, 37)

# absolute forecast horizon
fh = ForecastingHorizon(pd.PeriodIndex(pd.date_range("1961-01", periods=36, freq="M")), is_relative=False)

Tags¶

  • requires-fh-in-fit, whether or not the forecaster requires the forecasting horizon in fit
  • scitype:y
    • univariate, fit one model per column
    • multivariate, forecast feature will depend on values of other features
    • both, input contains multiple features, and that one of those features is the target
  • capability:pred_int, whether the forecaster implements probabilistic predictions
  • ignores-exogeneous-X
    • False, use exogeneous features
    • True, not use exogeneous features, X is ignored
  • handles-missing-data, whether the forecaster can handle missing data in the inputs
  • y_inner_mtype, X_inner_mtype, whether the forecast can handle panel or hierarchical data

List Tags¶

In [34]:
from sktime.forecasting.vecm import VECM
forecaster = VECM()

forecaster.get_class_tags()
Out[34]:
{'scitype:y': 'multivariate',
 'ignores-exogeneous-X': False,
 'capability:pred_int': True,
 'handles-missing-data': False,
 'y_inner_mtype': 'pd.DataFrame',
 'X_inner_mtype': 'pd.DataFrame',
 'requires-fh-in-fit': False,
 'X-y-must-have-same-index': True,
 'enforce_index_type': None,
 'fit_is_empty': False,
 'python_version': None,
 'python_dependencies': 'statsmodels',
 'univariate-only': False}
In [1]:
from sktime.registry import all_estimators
In [ ]:
all_estimators("forecaster", as_dataframe=True)

Univariate models¶

In [ ]:
all_estimators("forecaster", filter_tags={"scitype:y": ["univariate"]}, as_dataframe=True)

Multivariate models¶

In [ ]:
all_estimators(filter_tags={"scitype:y": ["multivariate", "both"]}, as_dataframe=True)

Models supporting probabilistic forecasting¶

In [ ]:
all_estimators(filter_tags={"capability:pred_int": True}, as_dataframe=True)

Reference¶

  • Build Complex Time Series Regression Pipelines with sktime
  • API