# sktime

> Unified scikit-learn-style toolkit for time series ML

- Category: Science & Biomedical AI / Biosignals & Time-Series ML
- Language: Python
- Repository: https://github.com/sktime/sktime
- Website: https://www.sktime.net
- Canonical page: https://ai-tldr.dev/tools/sktime/

## In short

sktime is a Python library for machine learning with time series. It sits in the Biosignals & Time-Series ML category of the Science & Biomedical AI tools and is open-source, written in Python. To get started: install sktime.

## Overview

sktime is a Python library for machine learning with time series. It offers a single, unified interface across several time series learning tasks, so the same fit and predict pattern works whether you are forecasting a signal, classifying it, or transforming it.

The framework follows scikit-learn interface conventions and interoperates with scikit-learn, statsmodels, tsfresh, and PyOD. It builds on pandas and NumPy data structures and runs in memory on a single machine, which keeps it approachable for people who already know the scientific Python stack.

Because it treats a time series as the core data type, sktime is a practical base for physiological and biosignal work, where recordings such as heart-rate or EEG traces need to be classified, forecast, or turned into features before further analysis.

## What it does

- Unified scikit-learn-style interface across multiple time series tasks
- Forecasting, classification, regression, and transformations as stable modules
- Clustering, anomaly and changepoint detection, and distances or kernels as maturing modules
- Composite model building with pipelines, ensembling, and tuning
- Interfaces to scikit-learn, statsmodels, tsfresh, and PyOD
- Extension templates for adding custom algorithms

## Getting started

Install sktime with pip, then load a series and fit a forecaster using the scikit-learn-style API.

1. Install sktime

   Install the core package from PyPI. To pull in optional dependencies for all modules, install the all_extras variant instead.

```bash
pip install sktime
```

2. Install with all dependencies (optional)

   Some modules rely on extra libraries. This variant installs sktime together with those optional dependencies.

```bash
pip install sktime[all_extras]
```

3. Fit a forecaster

   Load a sample series, split it into train and test periods, then fit a forecaster and predict over the test index using the familiar fit and predict pattern.

```python
from sktime.datasets import load_airline
from sktime.forecasting.theta import ThetaForecaster
from sktime.split import temporal_train_test_split

y = load_airline()
y_train, y_test = temporal_train_test_split(y)
forecaster = ThetaForecaster(sp=12)
forecaster.fit(y_train)
y_pred = forecaster.predict(y_test.index)
```

## When to use it

- Forecast future values of a time series, such as demand, sensor, or vital-sign readings
- Classify physiological and biosignal recordings like ECG or EEG traces into categories
- Turn raw time series into features with transformations before feeding them to a model
- Build and tune composite pipelines that combine transformations, models, and validation
