Home

Awesome

Welcome to sktime

<a href="https://www.sktime.net"><img src="https://github.com/sktime/sktime/blob/main/docs/source/images/sktime-logo.svg" width="175" align="right" /></a>

A unified interface for machine learning with time series

:rocket: Version 0.35.0 out now! Check out the release notes here.

sktime is a library for time series analysis in Python. It provides a unified interface for multiple time series learning tasks. Currently, this includes forecasting, time series classification, clustering, anomaly/changepoint detection, and other tasks. It comes with time series algorithms and scikit-learn compatible tools to build, tune, and validate time series models.

Documentation · Tutorials · Release Notes
Open SourceBSD 3-clause
TutorialsBinder !youtube
Community!discord !slack
CI/CDgithub-actions readthedocs platform
Code!pypi !conda !python-versions !black
DownloadsPyPI - Downloads PyPI - Downloads Downloads
Citation!zenodo

:books: Documentation

Documentation
:star: TutorialsNew to sktime? Here's everything you need to know!
:clipboard: Binder NotebooksExample notebooks to play with in your browser.
:woman_technologist: ExamplesHow to use sktime and its features.
:scissors: Extension TemplatesHow to build your own estimator using sktime's API.
:control_knobs: API ReferenceThe detailed reference for sktime's API.
:tv: Video TutorialOur video tutorial from 2021 PyData Global.
:hammer_and_wrench: ChangelogChanges and version history.
:deciduous_tree: Roadmapsktime's software and community development plan.
:pencil: Related SoftwareA list of related software.

:speech_balloon: Where to ask questions

Questions and feedback are extremely welcome! We strongly believe in the value of sharing help publicly, as it allows a wider audience to benefit from it.

TypePlatforms
:bug: Bug ReportsGitHub Issue Tracker
:sparkles: Feature Requests & IdeasGitHub Issue Tracker
:woman_technologist: Usage QuestionsGitHub Discussions · Stack Overflow
:speech_balloon: General DiscussionGitHub Discussions
:factory: Contribution & Developmentdev-chat channel · Discord
:globe_with_meridians: Meet-ups and collaboration sessionsDiscord - Fridays 13 UTC, dev/meet-ups channel

:dizzy: Features

Our objective is to enhance the interoperability and usability of the time series analysis ecosystem in its entirety. sktime provides a unified interface for distinct but related time series learning tasks. It features dedicated time series algorithms and tools for composite model building, such as pipelining, ensembling, tuning, and reduction, empowering users to apply algorithms designed for one task to another.

sktime also provides interfaces to related libraries, for example scikit-learn, statsmodels, tsfresh, PyOD, and fbprophet, among others.

ModuleStatusLinks
ForecastingstableTutorial · API Reference · Extension Template
Time Series ClassificationstableTutorial · API Reference · Extension Template
Time Series RegressionstableAPI Reference
TransformationsstableTutorial · API Reference · Extension Template
Detection tasksmaturingExtension Template
Parameter fittingmaturingAPI Reference · Extension Template
Time Series ClusteringmaturingAPI Reference · Extension Template
Time Series Distances/KernelsmaturingTutorial · API Reference · Extension Template
Time Series AlignmentexperimentalAPI Reference · Extension Template
Time Series SplittersmaturingExtension Template
Distributions and simulationexperimental

:hourglass_flowing_sand: Install sktime

For troubleshooting and detailed installation instructions, see the documentation.

pip

Using pip, sktime releases are available as source packages and binary wheels. Available wheels are listed here.

pip install sktime

or, with maximum dependencies,

pip install sktime[all_extras]

For curated sets of soft dependencies for specific learning tasks:

pip install sktime[forecasting]  # for selected forecasting dependencies
pip install sktime[forecasting,transformations]  # forecasters and transformers

or similar. Valid sets are:

Cave: in general, not all soft dependencies for a learning task are installed, only a curated selection.

conda

You can also install sktime from conda via the conda-forge channel. The feedstock including the build recipe and configuration is maintained in this conda-forge repository.

conda install -c conda-forge sktime

or, with maximum dependencies,

conda install -c conda-forge sktime-all-extras

(as conda does not support dependency sets, flexible choice of soft dependencies is unavailable via conda)

:zap: Quickstart

Forecasting

from sktime.datasets import load_airline
from sktime.forecasting.base import ForecastingHorizon
from sktime.forecasting.theta import ThetaForecaster
from sktime.split import temporal_train_test_split
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

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()
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

:wave: How to get involved

There are many ways to join the sktime community. We follow the all-contributors specification: all kinds of contributions are welcome - not just code.

Documentation
:gift_heart: ContributeHow to contribute to sktime.
:school_satchel: MentoringNew to open source? Apply to our mentoring program!
:date: MeetingsJoin our discussions, tutorials, workshops, and sprints!
:woman_mechanic: Developer GuidesHow to further develop sktime's code base.
:construction: Enhancement ProposalsDesign a new feature for sktime.
:medal_sports: ContributorsA list of all contributors.
:raising_hand: RolesAn overview of our core community roles.
:money_with_wings: DonateFund sktime maintenance and development.
:classical_building: GovernanceHow and by whom decisions are made in sktime's community.

:trophy: Hall of fame

Thanks to all our community for all your wonderful contributions, PRs, issues, ideas.

<a href="https://github.com/sktime/sktime/graphs/contributors"> <img src="https://opencollective.com/sktime/contributors.svg?width=600&button=false" /> </a> <br>

:bulb: Project vision