pyts

0.13.0 · active · verified Thu Apr 16

pyts is a Python package dedicated to time series classification. It provides preprocessing and utility tools, along with implementations of various time series classification algorithms. The library maintains an active development status, with major versions often introducing new Python support and algorithms, currently at version 0.13.0.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart loads the 'GunPoint' dataset, initializes a `TimeSeriesForest` classifier, trains it on the training data, and evaluates its accuracy on the test set. This demonstrates a common workflow for time series classification using `pyts`.

import numpy as np
from pyts.datasets import load_gunpoint
from pyts.classification import TimeSeriesForest

# Load the GunPoint dataset
X_train, X_test, y_train, y_test = load_gunpoint(return_X_y=True)

# Initialize and train the Time Series Forest classifier
clf = TimeSeriesForest(random_state=43)
clf.fit(X_train, y_train)

# Evaluate the classifier
accuracy = clf.score(X_test, y_test)
print(f"Accuracy of TimeSeriesForest: {accuracy:.4f}")

view raw JSON →