Differentiable computations of the signature and logsignature transforms, on both CPU and GPU.
Project description
Differentiable computations of the signature and logsignature transforms, on both CPU and GPU.
What is the signature transform?
The signature transform is roughly analogous to the Fourier transform, in that it operates on a stream of data (often a time series). Whilst the Fourier transform extracts information about frequency, the signature transform extracts information about order and area. Furthermore (and unlike the Fourier transform), order and area represent all possible nonlinear effects: the signature transform is a universal nonlinearity, meaning that every continuous function of the input stream may be approximated arbitrary well by a linear function of its signature. If you’re doing machine learning then you probably understand why this is such a desirable property!
Besides this, the signature transform has many other nice properties – robustness to missing or irregularly sampled data; optional translation invariance; optional sampling invariance. Furthermore it can be used to encode certain physical quantities, and may be used for data compression.
Check out this for a primer on the use of the signature transform in machine learning, just as a feature transformation, and this for a more in-depth look at integrating the signature transform into neural networks.
Installation
pip install signatory==<SIGNATORY_VERSION>.<TORCH_VERSION> --no-cache-dir --force-reinstall
where <SIGNATORY_VERSION> is the version of Signatory you would like to download (the most recent version is 1.2.6) and <TORCH_VERSION> is the version of PyTorch you are using.
Available for Python 3.6, 3.7, 3.8 on Linux and Windows. Requires PyTorch 1.6.0, 1.7.0, or 1.7.1.
(If you need it, then previous versions of Signatory included support for older versions of Python, PyTorch, and MacOS, see here.)
After installation, just import signatory inside Python.
Take care not to run pip install signatory, as this will likely download the wrong version.
Example:
For example, if you are using PyTorch 1.7.1 and want Signatory 1.2.4, then you should run:
pip install signatory==1.2.4.1.7.1 --no-cache-dir --force-reinstall
Why you need to specify all of this:
Yes, this looks a bit odd. This is needed to work around limitations of PyTorch and pip.
The --no-cache-dir --force-reinstall flags are because pip doesn’t expect to need to care about versions quite as much as this, so it will sometimes erroneously use inappropriate caches if not told otherwise.
Installation from source is also possible; please consult the documentation. This also includes information on how to run the tests and benchmarks.
If you have any problems with installation then check the FAQ. If that doesn’t help then feel free to open an issue.
Documentation
The documentation is available here.
Example
Usage is straightforward. As a simple example,
import signatory
import torch
batch, stream, channels = 1, 10, 2
depth = 4
path = torch.rand(batch, stream, channels)
signature = signatory.signature(path, depth)
# signature is a PyTorch tensor
For further examples, see the documentation.
Citation
If you found this library useful in your research, please consider citing the paper.
@inproceedings{kidger2021signatory,
title={{S}ignatory: differentiable computations of the signature and logsignature transforms, on both {CPU} and {GPU}},
author={Kidger, Patrick and Lyons, Terry},
booktitle={International Conference on Learning Representations},
year={2021},
note={\url{https://github.com/patrick-kidger/signatory}}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for signatory-1.2.6.1.8.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a8581415fcc48139fb9b061b049ac44e2646cccc927a75cb12bdc2792efe177 |
|
MD5 | 079936648d6ab422211e3d0de10e3313 |
|
BLAKE2b-256 | 4ab15091a5a7a5323cf745c16c26603eb7edb8a6dfe5dc93961de973debb4dcd |
Hashes for signatory-1.2.6.1.8.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ccb990a595350ba9be6b31cfecdfaee0cfb67b48bd2eaffc749321bbde4cb92 |
|
MD5 | 06a3307e1129297d2215cea8abc8b9c3 |
|
BLAKE2b-256 | 671896c0806632b42276f4f3c6b501b4475374366423f48aad43597809b3f333 |
Hashes for signatory-1.2.6.1.8.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5022e5348b341b52535a7702263651d77142d3df2ddbd582f7ff440c4d4d8929 |
|
MD5 | 3e941eb496a67ef9bcb641d0a48d20f9 |
|
BLAKE2b-256 | a377083ad7533e0c12ccb68910cff247d199a06aff41e13d4dcb809084748d76 |
Hashes for signatory-1.2.6.1.8.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b01d25f7c13d1da81088cc0d00d47caa270c66e54354c8a28f872ab8d99691ce |
|
MD5 | 681b8f3647361267a388597b26b20b88 |
|
BLAKE2b-256 | 6d0fb8bd66d3f3cd21bfb10f2651be47faf14f7453c7ebfc157ed23b742bd192 |