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.3) and <TORCH_VERSION> is the version of PyTorch you are using.
Available for Python 2.7, 3.5, 3.6, 3.7, 3.8 and Linux, Mac, Windows. Requires PyTorch 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1 or 1.6.0.
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.6.0 and want Signatory 1.2.2, then you should run:
pip install signatory==1.2.2.1.6.0 --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.
@article{signatory,
title={{Signatory: differentiable computations of the signature and logsignature transforms, on both CPU and GPU}},
author={Kidger, Patrick and Lyons, Terry},
journal={arXiv:2001.00706},
url={https://github.com/patrick-kidger/signatory},
year={2020}
}
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.3.1.5.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22447f2a71e1a91e65c48dbe848671e46fd752b7d294f3af130033b9d5d4bedf |
|
MD5 | 20b0d10181bad7b9a84388a5f0eac052 |
|
BLAKE2b-256 | c8cb65c2e98156c6f8a9611514150c26ac44f1e99530490f998facc4b7e277dc |
Hashes for signatory-1.2.3.1.5.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de8d244e86dec7b8b1c1aaadd005f316708f917bfb1800a0b5f42eadb48b03ad |
|
MD5 | d579af7ac18ea477aab84613f56a10fd |
|
BLAKE2b-256 | ae83d1756bc28c7904403b5acc06b0d60364a1ff24161acc997b444f49edcc1a |
Hashes for signatory-1.2.3.1.5.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8aa8a0c34618dfac00aba3d5d98f1005ce647940964969c494dddfdeb70b822 |
|
MD5 | 8e8298e239456967bc5458562c5be08b |
|
BLAKE2b-256 | eeafb0f6dd98e262937d6e0849ceca55a11071dd12c36c6f0cc71f8cac88769d |
Hashes for signatory-1.2.3.1.5.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 694dda7ad2c0f0ffeb8757fb1d7df70fc5849f64823091f96289e6a96d36b8ad |
|
MD5 | 1306ff5e82e3ec3ee01ea080908983cf |
|
BLAKE2b-256 | 178bac9195bcaa7f4b496378cd5ab99ec3fcbe3ed36a3415230456a1cfa7a438 |
Hashes for signatory-1.2.3.1.5.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62a1e457ac87497c1fab1a2f0d470c5082b5d77b77c77eb6bfbcc28e31206443 |
|
MD5 | 42e716eb169baafe0ad3747509dd32b9 |
|
BLAKE2b-256 | 12e12f7036ebbe974edaa7a5d2e11a8ac28e30d011d7e0c7617fd8eca2507184 |
Hashes for signatory-1.2.3.1.5.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24499170220aa47b9fde31887dba8bccb01a777587be65a1170b2187b5d3391f |
|
MD5 | cabb7412c1e1bf4674720501e78fe7d9 |
|
BLAKE2b-256 | 5ad47b11e9b4cb0f2a8614a549ccb290300a6970c813a27942db61ef1bb8dfd3 |
Hashes for signatory-1.2.3.1.5.1-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf0b7cc110aeec51f5fba2779965dfc222ef52fe2ed5f5e91406c1cd54997afc |
|
MD5 | 1280b237c9aa5c0e3f218d8c4bb78a70 |
|
BLAKE2b-256 | 20dbd49d302b9cba068ddfd8baff0b42a62558a04cb101ca6815f17a67486fc8 |