Skip to main content

Feature extraction from time series to support the creation of interpretable and explainable predictive models.

Project description

InterpreTS - Overview

interpreTS is a Python library designed for extracting meaningful and interpretable features from time series data to support the creation of interpretable and explainable predictive models.

Key Features

  • Feature Extraction: Extract features such as mean, variance, spikeness, entropy, trend strength, and more.
  • Interpretable Models: Generate explainable predictive models by leveraging extracted features.
  • Streaming Data Support: Process and extract features in real-time from streaming data sources.
  • Scalability: Supports parallel and distributed computation with joblib and dask.
  • Custom Features: Extend the library with user-defined features.
  • Validation: Ensures input data meets the required format and quality using built-in validators.

Requirements

  • Python 3.10 or above
  • pandas==2.2.3
  • numpy
  • statsmodels==0.14.4
  • langchain_community==0.3.14
  • langchain==0.3.14
  • openai==1.59.4
  • streamlit==1.41.1
  • scikit-learn
  • joblib==1.4.2
  • tqdm==4.67.1
  • dask==2024.12.1
  • scipy==1.15.0
  • pillow==11.1.0

Installation Guide

Follow these steps to install InterpreTS and its dependencies:

From PyPI

pip install interpreTS

From Source

  1. Clone the repository:
git clone https://github.com/yourusername/interpreTS.git
cd interpreTS
  1. Install dependencies: Install the required packages listed in the requirements.txt file:
pip install -r requirements.txt
  1. Install InterpreTS: Run the following command to install InterpreTS:
pip install .

GUI

InterpreTS offers a user-friendly GUI to facilitate time series feature extraction and model explainability.

Accessing the GUI

The GUI is hosted online and available at InterpreTS GUI.

Alternatively, you can run it locally:

  1. Navigate to the GUI directory:
cd interpreTS/core/gui
  1. Launch the GUI using Streamlit:
streamlit run gui.py

Features of the GUI

  • Feature Extraction: Easily upload time series data and extract predefined or custom features.
  • Visualization: View extracted features directly in the GUI.

Verifying Installation - Example: Basic Feature Extraction

Once installed, you can verify the installation by running a simple feature extraction example:

import pandas as pd
from interpreTS import FeatureExtractor, Features

# Sample time series data
data = pd.DataFrame({
"time": pd.date_range("2023-01-01", periods=10, freq="D"),
"value": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
})

# Initialize the FeatureExtractor
extractor = FeatureExtractor(features=[Features.MEAN, Features.VARIANCE], feature_column="value")

# Extract features
features_df = extractor.extract_features(data)
print(features_df)

Additional Usage Example with Time Series Data

import pandas as pd
import numpy as np
import time
from interpreTS import FeatureExtractor, Features

def report_progress(progress):
   print(f"Progress: {progress}%", flush=True)

# Generate synthetic time series data
data = pd.DataFrame({
'id': np.repeat(range(100), 100),  
'time': np.tile(range(100), 100),  
'value': np.random.randn(10000)  
})

# Initialize the FeatureExtractor
feature_extractor = FeatureExtractor(
features=[Features.ENTROPY],
feature_column="value",
id_column="id",
window_size=5,  # Rolling window size
stride=2        # Step size for moving the window
)

# Measure execution time
start_time = time.time()

# Extract features
features_df = feature_extractor.extract_features(data, progress_callback=report_progress, mode='sequential')

end_time = time.time()

# Display results and execution time
print(features_df.head())  # Display the first few rows of the resulting DataFrame
print(f"Execution time: {end_time - start_time:.2f} seconds")

Documentation

Complete documentation is available on GitHub Pages.

Issues and Support

For any issues, please consult our Issue Tracker on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

InterpreTS-0.5.0.tar.gz (49.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

InterpreTS-0.5.0-py3-none-any.whl (97.7 kB view details)

Uploaded Python 3

File details

Details for the file InterpreTS-0.5.0.tar.gz.

File metadata

  • Download URL: InterpreTS-0.5.0.tar.gz
  • Upload date:
  • Size: 49.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for InterpreTS-0.5.0.tar.gz
Algorithm Hash digest
SHA256 7e7daad59c3522a0e1266c91f26b258dd30e82d4f666052f5a20512cc5eb8a8d
MD5 2772318b4022d1535c355a4737b32a8d
BLAKE2b-256 ac0aa7b8d54e0f80a3da00cb3a377cf427f315eea8236284a11802aa51f345f1

See more details on using hashes here.

File details

Details for the file InterpreTS-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: InterpreTS-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 97.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for InterpreTS-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f339c00ca41d78693627d97dc55422700c7042c80764c9c3a39fad3b45776db
MD5 c5c09006f32ceade4f6b090490037e2f
BLAKE2b-256 102f8abc3f65eac5217b95e36d7583f0799d82868efdc4a2b272aca978d0ee46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page