Skip to content

4d30/sampen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPU-Accelerated Sample Entropy in Python

This repository provides a fast, GPU-accelerated implementation of Sample Entropy (SampEn) for time series analysis using Python, Numba, and CUDA.

Sample Entropy is a widely-used statistical measure that quantifies the complexity or regularity of a time series. This implementation leverages GPU parallelism to efficiently compute SampEn for large datasets. It has been benchmarked as 100x faster than CPU-based implementations.

Features

  • Efficient GPU-based kernel using Numba CUDA
  • Chebyshev distance for sequence similarity
  • Dynamic chunk processing to handle large time series
  • Graceful handling of edge cases (zero matches, infinite entropy)

Requirements

  • Python 3.8+
  • NumPy
  • Numba
  • CUDA-enabled GPU and NVIDIA drivers

Installation

Install from PyPI

  • pip install sampen-gpu

Install from source

git clone https://github.com/4d30/sampen.git
cd sampen
pip install -e .

Usage

from sampen import sampen
import numpy as np

data = np.random.rand(10000)  # your time series data
m = 2                         # template length
r = 0.2                       # similarity threshold

entropy = sampen(data, m, r)
print("Sample Entropy:", entropy)

About

This module leverages numba to calculate a timeseries signal's sample entropy on a CUDA GPU. It's 100x faster than CPU implementations.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages