Skip to main content

Fast rough path signatures - faster than iisignature, comparable to pysiglib

Project description

chen-signatures

Fast rough path signatures for Python, powered by Julia.

1.6× faster than iisignature with support for modern Python (3.9-3.13).

PyPI Python

Why chen-signatures?

Feature chen-signatures iisignature
Speed 187 ms 299 ms
Python 3.10+ ✅ Yes ❌ No (≤3.9 only)
Python 3.13 ✅ Yes ❌ No
Autodiff ✅ Yes (ForwardDiff) ❌ No
Maintained ✅ Active ⚠️ Unmaintained

Benchmark: N=1000 points, d=10 dims, level=5

Installation

pip install chen-signatures

First import will automatically install Julia (via juliacall). Takes ~2 minutes once.

Quick Start

import chen
import numpy as np

# Your time series data
path = np.random.randn(1000, 10)  # 1000 timepoints, 10 dimensions

# Compute signature
signature = chen.sig(path, m=5)

# Compute log-signature  
logsignature = chen.logsig(path, m=5)

API

sig(path, m)

Compute the truncated signature up to level m.

Parameters:

  • path : (N, d) numpy array - Path data
  • m : int - Truncation level

Returns:

  • numpy.ndarray - Flattened signature coefficients

Example:

import chen
import numpy as np

path = np.array([[0., 0.], [1., 0.], [1., 1.]])
sig = chen.sig(path, m=3)
# Returns array of length d + d² + d³ = 2 + 4 + 8 = 14

logsig(path, m)

Compute the log-signature projected onto the Lyndon basis.

Parameters:

  • path : (N, d) numpy array - Path data
  • m : int - Truncation level

Returns:

  • numpy.ndarray - Log-signature in Lyndon basis

Example:

logsig = chen.logsig(path, m=5)

Supported Types

  • float32 and float64
  • Any numpy array-like input

Performance

Production-scale benchmark (N=1000, d=10, m=5):

import chen
import numpy as np
import time

path = np.random.randn(1000, 10)

t0 = time.time()
sig = chen.sig(path, 5)
print(f"Time: {(time.time()-t0)*1000:.1f} ms")
# Output: Time: 187.4 ms

Compare to iisignature: 299.3 ms (1.6× slower)

Use Cases

  • Financial time series: Extract signature features from price data
  • Sensor data: Process multivariate sensor streams
  • Neural CDEs: Differentiable features for neural networks
  • Anomaly detection: Signature-based feature engineering

Limitations

  • First import is slow (~2 min to install Julia environment, one-time)
  • Not GPU-accelerated (CPU only, but very fast)
  • Memory usage: Uses more RAM than iisignature (but negligible for most applications)

Requirements

  • Python ≥3.9
  • NumPy ≥1.20
  • ~500MB disk space (for Julia installation)

Citation

If you use this in research, please cite:

@software{chen_signatures,
  author = {Combi, Alessandro},
  title = {chen-signatures: Fast rough path signatures for Python},
  year = {2025},
  url = {https://github.com/aleCombi/ChenSignatures.jl}
}

License

MIT License - see LICENSE file.

Contributing

Issues and pull requests welcome at github.com/aleCombi/ChenSignatures.jl

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

chen_signatures-0.1.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

chen_signatures-0.1.7-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file chen_signatures-0.1.7.tar.gz.

File metadata

  • Download URL: chen_signatures-0.1.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for chen_signatures-0.1.7.tar.gz
Algorithm Hash digest
SHA256 c89e5f93cc383329f7d4f819a1bab1bacd3384bb38e869dd61b211c00d1d3708
MD5 c3bdbd6fdc3acdd5a9817ba9b7a9c666
BLAKE2b-256 d673314e5cec419d76c8ab6a4b584df1bee739318e1c0b64e05006e886f93c1f

See more details on using hashes here.

File details

Details for the file chen_signatures-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for chen_signatures-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fb2d386a54a7377145b6dc1e0599eae4e8fcc4efd76d3e1aaa346e819911e6c5
MD5 10ca8412bc10aa1d86601316b54eaa8b
BLAKE2b-256 d589386219ef0dba1fb0ebc7adcf154f49009afcff9a544fe1f6b34e96fc95c8

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