Learn All About Using Sktime For Time Series Forecasting (Part 1)
Performing Reductions with Time-Series

Time-series tasks are closely related, each with distinct learning settings can be solved via Reductions. Using Reduction, any algorithm for a particular task gets converted into a learning algorithm for the new task and if any changes are made to the original algorithm, changes are immediately transferred to the new task.

Reductions usually involve segmenting task to be performed into simpler sub-tasks and all the segments solutions are composed to give the solution of the original task, hence Reductions are good ways to reduce confusion between tasks and help us better understand the relationships between tasks and it can be used to solve more complicated tasks.

An example of reduction can be solving classical forecasting tasks through time-series regression via a sliding windows approach and iterating over the forecasting horizon.

Task-Specific Estimators and Transformers

As we all know in scikit-learn we use the fit method to learn training data for a model and predict to make any predictions based on the model and test-data, similarly, estimators in sktime are task-specific means they extend scikit-learns regressor and classifiers to their own time-series as well. They have their own estimators also such as forecasters and supervised forecasters with the same fit and predict method.

Similar to estimators we have transformers in sktime which also consists of a fit method to fit and learn the training data and a transform method that transforms the input data. There are different types of data transformations available for different types of tasks such as:

Tabular: Similar to transformers in scikit-learn. Series-to-Primitives: Transforms time series for each instance into a primitive number. Series-to-Series: Transforms time series for each instance into a series i.e the output of the transformation is itself a series instead of a primitive number. Detrending: transforms an input time series into a detrended time series in the same range/domain as the input series.

Time-Series Forecasting with Sktime

Let past observations for a single time-series be represented as:

y = [y(t1), y(t2), ....., y(tn)]

The task here is to learn a forecaster F which can make accurate temporal predictions in future out of all the observations at a given time in point hj of the forecasting horizon, where predictions are represented by:

Y = F(hj) or Y = [Y(h1), Y(h2), ....., Y(hj)]

Key points to remember

We can apply any scikit-learns regressor to solve our forecasting problem that means it is compatible with scikit-learn python library.

to solve our forecasting problem that means it is with scikit-learn python library. Easy to tune hyperparameters like the length of sliding window.

like the length of sliding window. To tune and to properly evaluate our model it can adapt scikit-learn estimators interface to that of forecasters.

The package is available via PyPI using:

pip install sktime

Importing all the required packages and the dataset used for this article is the Box-Jenkins airline data set, which shows the number of international airline passengers per month from the year 1949–1960.
['Mrinal Walia']
['Python', 'Data Science', 'Sktime', 'Scikit Learn', 'Time Series Forecasting']