Skip to main content

Fast path signatures

Project description

chen-signatures

Fast rough path signatures for Python, powered by a high-performance Julia backend.

PyPI Python

chen-signatures brings the speed and numerical stability of Julia’s ChenSignatures.jl to Python via juliacall, offering a modern, actively maintained alternative to existing signature libraries.

It has been benchmarked against both iisignature and pysiglib, showing:

  • Comparable performance to pysiglib, a modern C++/Python implementation
  • Consistently faster performance than iisignature across typical configurations

Full benchmark notebooks and articles will be published separately.


Installation

pip install chen-signatures

On first import, juliacall will automatically install a lightweight Julia runtime. This happens once per environment.


Quick Start

import chen
import numpy as np

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

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

# Compute log-signature (requires prepare step)
basis = chen.prepare_logsig(d=10, m=5)  # d must match path dimension
logsignature = chen.logsig(path, basis)

API

sig(path, m)

Compute a truncated signature up to level m.

signature = chen.sig(path, m=3)

Args:

  • path: (N, d) array-like where N is path length, d is dimension
  • m: truncation level (positive integer)

Returns: 1D numpy array of signature coefficients


prepare_logsig(d, m)

Precompute and cache the Lyndon basis for log-signature computation.

basis = chen.prepare_logsig(d=10, m=5)

Args:

  • d: path dimension (positive integer)
  • m: truncation level (positive integer)

Returns: Basis cache object (reusable across multiple paths)


logsig(path, basis)

Compute log-signatures using a precomputed Lyndon basis.

basis = chen.prepare_logsig(d=10, m=5)
logsig = chen.logsig(path, basis)

Args:

  • path: (N, d) array-like where N is path length, d is dimension
  • basis: Basis object from prepare_logsig(d, m)

Returns: 1D numpy array of log-signature coefficients (Lyndon basis projection)

Note: The basis object should match the dimension of your path. Prepare it once and reuse for multiple paths of the same dimension.


Supported Types

  • float32, float64
  • Any NumPy array-like input
  • Contiguous arrays recommended (handled automatically)

Use Cases

  • Financial time series and derivatives pricing
  • Neural CDEs and machine learning
  • Feature engineering and representation learning

Limitations

  • First import is slow (Julia installation)
  • CPU-only execution
  • Uses more memory than minimal C++ libraries

Requirements

  • Python ≥ 3.9
  • NumPy ≥ 1.20
  • ~500MB disk space for Julia runtime

Citation

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

Contributing

Issues and feedback are welcome at https://github.com/aleCombi/ChenSignatures.jl/issues

However, pull requests are not being accepted at this time.

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.3.1.tar.gz (12.0 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.3.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chen_signatures-0.3.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for chen_signatures-0.3.1.tar.gz
Algorithm Hash digest
SHA256 f7050151f4c5497320edd0f17689c433d7a9f6e5fa6419745495beced84b2708
MD5 f727d5be116fda581cfda5f26ebfcf52
BLAKE2b-256 8a8a031ad1222c8ab1f64df1f117003a3befe1494a3475a4a66e2160938ca3ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chen_signatures-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04c29e557262097074a1b6a05e101a4876abe283d7e9942f40ffe8b35e2229eb
MD5 d1027afe118504f349bf601b987fb22e
BLAKE2b-256 5a5156f6c1e5250a44d2668f0461d379f0525efd9308f3be6856756a4716adc5

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