Skip to content

whackteachers/sktime

 
 

Repository files navigation

Welcome to sktime

A unified framework for machine learning with time series

We provide specialized time series algorithms and scikit-learn compatible tools to build, tune and validate time series models for multiple learning problems, including:

  • Forecasting,
  • Time series classification,
  • Time series regression.

For deep learning, see our companion package: sktime-dl.

CI github_ appveyor_ azure_ codecov_
Docs readthedocs_ binder_ tutorial_
Community contributors_ gitter_ discord_ twitter_
Code pypi_ conda_ _ codestyle_ zenodo_

Installation

The package is available via PyPI using:

pip install sktime

Alternatively, you can install it via conda:

conda install -c conda-forge sktime

The package is actively being developed and some features may not be stable yet.

Development version

To install the development version, please see our advanced installation instructions.

Quickstart

Forecasting

from sktime.datasets import load_airline
from sktime.forecasting.base import ForecastingHorizon
from sktime.forecasting.model_selection import temporal_train_test_split
from sktime.forecasting.theta import ThetaForecaster
from sktime.performance_metrics.forecasting import mean_absolute_percentage_error

y = load_airline()
y_train, y_test = temporal_train_test_split(y)
fh = ForecastingHorizon(y_test.index, is_relative=False)
forecaster = ThetaForecaster(sp=12)  # monthly seasonal periodicity
forecaster.fit(y_train)
y_pred = forecaster.predict(fh)
mean_absolute_percentage_error(y_test, y_pred)
>>> 0.08661467738190656

For more, check out the forecasting tutorial <https://github.com/alan-turing-institute/sktime/blob/main/examples/01_forecasting .ipynb>__.

Time Series Classification

from sktime.classification.interval_based import TimeSeriesForestClassifier
from sktime.datasets import load_arrow_head
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score

X, y = load_arrow_head(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y)
classifier = TimeSeriesForestClassifier()
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
accuracy_score(y_test, y_pred)
>>> 0.8679245283018868

For more, check out the time series classification tutorial.

Documentation

How to contribute

We follow the all-contributors specification - and all kinds of contributions are welcome!

If you have a question, chat with us or raise an issue. Your help and feedback is extremely welcome!

Development roadmap

  1. Multivariate/panel forecasting,
  2. Time series clustering,
  3. Time series annotation (segmentation and anomaly detection),
  4. Probabilistic time series modelling, including survival and point processes.

Read our detailed roadmap here.

How to cite sktime

If you use sktime in a scientific publication, we would appreciate citations to the following paper:

Markus Löning, Anthony Bagnall, Sajaysurya Ganesh, Viktor Kazakov, Jason Lines, Franz Király (2019): “sktime: A Unified Interface for Machine Learning with Time Series”

Bibtex entry:

@inproceedings{sktime,
    author = {L{\"{o}}ning, Markus and Bagnall, Anthony and Ganesh, Sajaysurya and Kazakov, Viktor and Lines, Jason and Kir{\'{a}}ly, Franz J},
    booktitle = {Workshop on Systems for ML at NeurIPS 2019},
    title = {{sktime: A Unified Interface for Machine Learning with Time Series}},
    date = {2019},
}

About

A unified toolbox for machine learning with time series

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 94.6%
  • C++ 4.9%
  • Other 0.5%