Skip to main content

High-performance signature computations in PyTorch, on both CPU and GPU, accelerated via C++ extensions, including backpropagation.

Project description

High-performance signature computations in PyTorch, on both CPU and GPU, accelerated via C++ extensions, including backpropagation.

What is the signature transform?

If you’re reading this documentation then it’s probably because you already know what the signature transform is, and are looking to use it in your project. But in case you’ve stumbled across this and are curious what all the fuss is about…

The ‘signature transform’ is a transformation that does a particularly good job extracting features from streams of data. Check out this for a primer on its use in machine learning, as a feature transformation. Then have a look here for a more in-depth look at building it into neural network models, as an arbitrary layer anywhere within a neural network. It’s pretty cool.

In brief: the signature of a path determines the path essentially uniquely, and does so in an efficient, computable way. Furthermore, the signature is rich enough that every continuous function of the path may be approximated arbitrarily well by a linear function of its signature; it is what we call a ‘universal nonlinearity’. Now for various reasons this is a mathematical idealisation not borne out in practice (which is why we put them in a neural network and don’t just use a simple linear model), but they still work very well!

Installation

Install via pip:

pip install signatory

Alternatively install via git:

git clone https://github.com/patrick-kidger/signatory.git
cd signatory
pip install .

Requires PyTorch. Tested with version 1.0.1.

Documentation

The documentation is available here.

FAQ

The main difference is that iisignature is NumPy-based and CPU-only. Meanwhile Signatory is for PyTorch and may also run on the GPU, as it is targeted towards machine learning applications. The two packages also use different embeddings from streams of data into path space – see the next question.

  • Why is the signature of a path different when I use the iisignature package?

The signature transform is defined on paths; given a stream of data we must decide how to embed it into a path. iisignature uses a piecewise linear embedding, whilst Signatory uses a piecewise constant embedding. From a data science point of view, both are equally arbitrary – so as long as you pick one and stick with it then it shouldn’t matter.

This embedding was selected for Signatory because signature calculations for this embedding may be done much more rapidly, with provably fewer scalar multiplications. Empirically it runs 3-4 times faster on the CPU than iisignature on reasonably sized batches. (Signatory is optimised for batched operations, using batches to be cache-friendly.)

Citation

If you found this library useful in your research, please consider citing

@article{deepsignatures,
    title={{Deep Signatures}},
    author={{Bonnier, Patric and Kidger, Patrick and Perez Arribas, Imanol and Salvi, Cristopher and Lyons, Terry}},
    journal={arXiv:1905.08494},
    year={2019}
}

which this project was a spin-off from.

Acknowledgements

The Python bindings for the C++ code were written with the aid of pybind11.

For NumPy-based CPU-only signature calculations, you may also be interested in the iisignature package, which was a source of inspiration for Signatory.

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

signatory-0.1.1.tar.gz (20.3 kB view details)

Uploaded Source

File details

Details for the file signatory-0.1.1.tar.gz.

File metadata

  • Download URL: signatory-0.1.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.6

File hashes

Hashes for signatory-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3a519de570091b1d46e6e3a792743e291fe93c1f1995a9c4704fc9a388b2dd95
MD5 e6fec369f28d566681e1feaeef512d41
BLAKE2b-256 5b2523e90abe0f7b3b6a1638c8471471491f2696ea80f828bc7939bcf2ee1123

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