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.8 or above
  • pandas>=1.1.0
  • numpy>=1.18.0
  • statsmodels
  • langchain_community
  • langchain
  • openai
  • scikit-learn
  • joblib
  • tqdm
  • dask
  • nbsphinx
  • myst-parser
  • scipy

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 .

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_params={Features.ENTROPY: {'bins': 2}},  # Specify parameters for 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.4.1.tar.gz (41.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.4.1-py3-none-any.whl (79.1 kB view details)

Uploaded Python 3

File details

Details for the file interprets-0.4.1.tar.gz.

File metadata

  • Download URL: interprets-0.4.1.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for interprets-0.4.1.tar.gz
Algorithm Hash digest
SHA256 c3a31c7545d98ed3cc30847e56c60597e42a83deb6348ef8a2b1b08ee5eebc63
MD5 3d79e4eb584595dc65ccbc0b359daebb
BLAKE2b-256 d19fdd188a1ac29b8a8718389940688410dcd0977cdeebf4ca82924a80fe3eab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: InterpreTS-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 79.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for InterpreTS-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7aed2da745ab160c380bfaaa0dc0bc04ce507b170af5b0465268f6af54022bc0
MD5 598f30c07b7ff52d2382018cb0dbeda8
BLAKE2b-256 7c5539b0ef74b8b6d31c8815e81b31e7df16138b849bc5340deb74e0bdbc7723

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