This package provides "rough path" tools for analysing vector time series.
Project description
esig
The Python package esig provides a toolset (previously called sigtools) for transforming vector time series in stream space to signatures in effect space. It is based on the libalgebra C++ library.
Installation
esig can be installed from a wheel using pip in most cases. The wheels contain all of the dependencies and thus make it easy to use the package. For example, on Python 3.8, you can install esig using the following console command:
python3.8 -m pip install esig
(You may need to tweak this command based on your platform, Python version, and preferences.)
esig can be compiled from source, but this is not advised. More information can be found in the documentation.
Basic usage
esig provides a collection of basic functions for computing the signature of a data stream in the form of a Numpy array.
The stream2sig
function computes the signature of a data stream up to a specific depth.
For example, we can create a very simple data stream and compute its signature as follows.
import numpy as np
import esig
stream = np.array([
[1.0, 1.0],
[3.0, 4.0],
[5.0, 2.0],
[8.0, 6.0]
])
depth = 2
sig = esig.stream2sig(stream, depth) # compute the signature
print(sig) # prints "[1.0, 7.0, 5.0, 24.5, 19.0, 16.0, 12.5]"
The signature is returned as a flat Numpy array that contains the terms of the signature - which is fundamentally a higher dimensional tensor - in degree order.
This first element is always 1.0, which corresponds to the empty tensor key.
In this case the dimension is 2 (specified by the number of columns in the stream array), and so the next two elements are the signature elements corresponding to the words (1) and (2).
These are the depth 1 words.
The final 4 elements are the depth 2 words (1,1), (1,2), (2,1), and (2,2).
esig provides the sigkeys
function to generate these labels for you based on the parameters of the data.
width = 2
sig_keys = esig.sigkeys(width, depth)
print(sig_keys) # prints " () (1) (2) (1,1) (1,2) (2,1) (2,2)"
To compute the log signature of a data stream you use the stream2logsig
function.
This works in a similar manner to the stream2sig
function in that it takes a Numpy array (the data) and a depth and returns a flat Numpy array containing the elements of the log signature in degree order.
log_sig = esig.stream2logsig(stream, depth)
print(log_sig) # prints "[7. 5. 1.5]"
Here the first two elements are the depth 1 Lie elements (corresponding to the letters 1 and 2) and the third element is the coefficient of the Hall basis element [1,2].
Again, esig provides a utility function logsigkeys
for getting the keys that correspond to the coefficients in order for the log signature.
log_sig_keys = esig.logsigkeys(width, depth)
print(log_sig_keys) # prints " 1 2 [1,2]"
There are two additional utility functions for computing the size of a signature or logsignature with a specified dimension and depth: sigdim
and logsigdim
.
These functions return an integer that is the dimension of the Numpy array returned from the stream2sig
or stream2logsig
functions, respectively.
esig also provides another function recombine
, which performs a reduction of a measure defined on a large ensemble in a way so that the resulting measure has the same total mass, but is supported on a (relatively) small subset of the original ensemble.
In particuar, the expected value over the ensemble with respect to the new measure agrees with that of the original measure.
Using alternative computation backends
esig uses libalgebra as a backend for computing signatures and log signatures
by default.
However, the computation backend can be changed to instead use an alternative
library for computing signatures and log signatures.
This is achieved by using the set_backend
function in esig and providing
the name of the backed that you wish to use.
For example, we can switch to using the iisignature
package as a backend by
first installing the iisignature
package and then using the command
import esig
esig.set_backend("iisignature")
To make it easier to install and use iisignature
as a backend, it is
offered as an optional extra when installing esig:
python3.8 -m pip install esig[iisignature]
You can also define your own backend for performing calculations by creating
a class derived from esig.backends.BackendBase
, implementing the methods
describe_path
(log_signature) and signature
and related methods.
##Changelog 0.9.8.2 Hotfix 2 - Fixed the range of configurations available. - Fixed MANIFEST.in, now reflects the updated project structure.
0.9.8.1 Hotfix - Fixed problem caused by reading data in from F-contiugous array - Fixed issue with readme on PyPI.
0.9.8 - Added support for Python3.10. - Updated build system to use cibuildwheel in Github actions. - Updated libalgebra to benefit from improvements to performance - Deprecated tosig submodule. The functions formerly from this module are available via the top-level esig module. The tosig module will be removed in version 1.0. - Removed builds on 32-bit Linux for Python 3.8+. There is no Numpy wheels on this architecture for these versions of Python.
0.9.0 - Switched Linux support to manylinux2010 - Support for 32-bit platforms
0.8.2 - Added builds for Python3.9 - Updated README
0.8.1 - Minor fixes to build routine
0.8.0 - Added Python interface in the package root to computation backends - Added iisignature backend to allow computation of signatures using the iisignature package - Added support for computing depth 1 signatures and logsignatures - Added new unit tests. - Made some changes to the build script - Added Python 3.9 build target
0.7.4 - Fixed message displayed for Python versions below 3.8 when importing esig
0.7.3 - Added recombine function
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
File details
Details for the file esig-0.9.8.2.tar.gz
.
File metadata
- Download URL: esig-0.9.8.2.tar.gz
- Upload date:
- Size: 153.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6a46ad156d242dab405e1d14777644490dfedf77f4cc0698c6e7dd6e22b28fc |
|
MD5 | df305ee12c56f6a4a74fe3e9155641d9 |
|
BLAKE2b-256 | 792875f92e92e761e1931481c8eab9c7e978ef3248dfebc965970bc4cf61da65 |
File details
Details for the file esig-0.9.8.2-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d93dff5b1422f7b430569a606fc406485e71b3344ac62186846bbf2aeab86e1 |
|
MD5 | fe6a5ad4148724e7ea6da0402ecc8f76 |
|
BLAKE2b-256 | e22d31eb3844a970ead45474c7ac7702a24c01145a35e7ad06ac4ec4e69eceac |
File details
Details for the file esig-0.9.8.2-cp310-cp310-win32.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp310-cp310-win32.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3da7badd65a78c5d073451a4a9d78d145e64239e87620cd506bd8f7819c6b35e |
|
MD5 | 18bcce4d63c517367b312f97553613e4 |
|
BLAKE2b-256 | 25d9ba2959b7a8bf2d21cdfc29a5344b6899e43961f4b26c0b9972d5e0a4cdd7 |
File details
Details for the file esig-0.9.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7e74c1b855fe4ec4781e0a4c1cbd0e41cb966304c5400e3dea79d6aed79b525 |
|
MD5 | 5f54ec24bebfbe51acc98255c6153ce2 |
|
BLAKE2b-256 | dd52d69a3e85af08df9e8c65a7ee0847d2c37a48bd2ead55e5648c3619783c4f |
File details
Details for the file esig-0.9.8.2-cp310-cp310-macosx_10_11_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp310-cp310-macosx_10_11_x86_64.whl
- Upload date:
- Size: 10.1 MB
- Tags: CPython 3.10, macOS 10.11+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3caee805d3d4c468bc1cefbe5554716bab83bdca82d38e43d500add90d64e46b |
|
MD5 | 27475b87ff17e1e92a74a4dadd5cfff8 |
|
BLAKE2b-256 | d20f10c0f5e3d22e99540e00a613ca3d5984cfe2b48783ad85ed1ee2c17722b8 |
File details
Details for the file esig-0.9.8.2-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320e586d4fadd1928f045c84443e313496af65510cbe6ab1325d3ebc57a67f3f |
|
MD5 | 21169877df79c028590bc5271e23d4cc |
|
BLAKE2b-256 | 4092775a0776687a3a5a6db64e06cd2a667d5ed43321df15450f92a59bc31e65 |
File details
Details for the file esig-0.9.8.2-cp39-cp39-win32.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp39-cp39-win32.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.9, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b69369d20c2a6b0d4e24ad7727545ee28e5a7985e7b707dced67237ba4587a7b |
|
MD5 | 87300a828053794c1f0d43976711c3a2 |
|
BLAKE2b-256 | e3663c35abff7b42deb9a926517d11dd3f2109b5de45236ee2a9cdc9cba9e253 |
File details
Details for the file esig-0.9.8.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cc59a16b88f19e8768ded53f812bc3ec2cf48e4d3ae5f01df15f2f2151fda38 |
|
MD5 | 158a9a139d328f97fb93049739f616b1 |
|
BLAKE2b-256 | 776ba6a502ecac248a12f033b7f274f0c3902082e7080d5f000a70d5e707b8e5 |
File details
Details for the file esig-0.9.8.2-cp39-cp39-macosx_10_11_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp39-cp39-macosx_10_11_x86_64.whl
- Upload date:
- Size: 10.1 MB
- Tags: CPython 3.9, macOS 10.11+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d2793c547bc56f6f9fffcf740cea4fadc08f331c0302be8c0edd08d8b6fc733 |
|
MD5 | c3fc793966f3fbd5943b5c74b437e4b4 |
|
BLAKE2b-256 | a8bdd4369a6cb14808aa2db49887e8413280599bb6b1126fc8c8fa2a86a016e4 |
File details
Details for the file esig-0.9.8.2-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 735dcd14ae604a8fd1d9b433fe1615bccd7953ca6fc9b372c10a370e164da18f |
|
MD5 | 645cbb4e84f76aae370ae6ad2913a7e2 |
|
BLAKE2b-256 | abfcb1f6a2f9953b746db213c048403a1023c5c8a385159a97af2cf3d77a5149 |
File details
Details for the file esig-0.9.8.2-cp38-cp38-win32.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp38-cp38-win32.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4305053963f6ddd684ee7ce6147ac24d64c4e1bdfb30920ef379b76fa80382d9 |
|
MD5 | 8801a5e5781c4c5351c522e9d74b746d |
|
BLAKE2b-256 | 5d8cf1a270fe63f7dd770aeb86a3b154868ce48cdb5ab7156f929a794dee128e |
File details
Details for the file esig-0.9.8.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77b304be42679cecf9945d7084f7c078c3d28db02871d3ab39580fb3cb53a9e2 |
|
MD5 | 2369803f5a24896001ad0199c10cb910 |
|
BLAKE2b-256 | e3a71713815a566d4cee5495c78c0e0309a52db13f7d72e7e74a7ad36e055e60 |
File details
Details for the file esig-0.9.8.2-cp38-cp38-macosx_10_11_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp38-cp38-macosx_10_11_x86_64.whl
- Upload date:
- Size: 10.1 MB
- Tags: CPython 3.8, macOS 10.11+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 067ac44a85d178af5c2271db7a55278fe8cbfc1c865a9912a7efcc1e1de53b9a |
|
MD5 | 5e9bd3e47aebf7e22eae2f616044e3e6 |
|
BLAKE2b-256 | 1490c28c626ba5f852a9aae4c955cde6e77be89c77e09e4d9845f8b039ef35f9 |
File details
Details for the file esig-0.9.8.2-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dc5b01755e132864f05956441d67a7d805232767434fa2b68fb9757b8f350b4 |
|
MD5 | 70cb9f49423253d5ed5373fe2d7bf828 |
|
BLAKE2b-256 | 8e4651e7eae564259b7bcf24ea7424ba3b0b0415cb0dcffa91752af94fc18a05 |
File details
Details for the file esig-0.9.8.2-cp37-cp37m-win32.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp37-cp37m-win32.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7fa3bf57c8c22e63bf89107341d26649d55d7c97f21ecfe3cd08f04657c4694 |
|
MD5 | 2cbb708a7e18a99053e4e84a3355f0ac |
|
BLAKE2b-256 | 9002a9c641300f0b49454a7c3f10464bba0d451a6a16b7e327a82931640d0b79 |
File details
Details for the file esig-0.9.8.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79dfed23fca5f2dda614e30143d7e7ecd4b14d9d53b6db61fa573a3dc11834db |
|
MD5 | ce452444b7e954a1994ed8d4d4b284f6 |
|
BLAKE2b-256 | 3874e5a0c42920e3078c4be63cc500e8ddbf29d0703ba5edda3b82d8d89be857 |
File details
Details for the file esig-0.9.8.2-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd19e2c2c653204e862a29053f7263bf712361503a4b5913220e93184a0fffb7 |
|
MD5 | a153ceeab4b6f23dbd478dd5cef8e798 |
|
BLAKE2b-256 | 6ab3c527e26de68238127a200f8d40a622e207c3b1b72a94f5d8d8b1743ff27f |
File details
Details for the file esig-0.9.8.2-cp37-cp37m-macosx_10_11_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp37-cp37m-macosx_10_11_x86_64.whl
- Upload date:
- Size: 10.1 MB
- Tags: CPython 3.7m, macOS 10.11+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11551f0a400d80c480de2a009bb9a54b5e10d8679d49940864cfc87839931b4a |
|
MD5 | 416e8ab8cfd42d337e31058d6fe02aa3 |
|
BLAKE2b-256 | 7d9ab1c82cf5b31eeb8939525e64316436d91dd018ed5e78ef72fc2056fa2616 |
File details
Details for the file esig-0.9.8.2-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a96476806e2c35b8bb25d9228706525e307e44166159fa445a0498fb8feef656 |
|
MD5 | 825285061e11205a89e436131377dca5 |
|
BLAKE2b-256 | b74e78768530c5836371f546a2f719cce30d7d152115474f49daf199c2bbecdd |
File details
Details for the file esig-0.9.8.2-cp36-cp36m-win32.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp36-cp36m-win32.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f7f281014959a272007900259f19ba619b400657d4b918a9d4babc90197b440 |
|
MD5 | 06088d2c37aec13cab05cfbef4ffa949 |
|
BLAKE2b-256 | 026721db99d63761afbb7801c45ea53f7c18909a6aa4806fdbebe30142b04e86 |
File details
Details for the file esig-0.9.8.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.6m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 948e350efa91252a5142575c476c3adaae73a6acad0900ce75e15b71242af24b |
|
MD5 | 8decc2d1fefec19574bc1951b43ee3c0 |
|
BLAKE2b-256 | 3181d1ed4dbb6478b63967c70b30a724e13f6ba506af07fb5ce2916e660d263a |
File details
Details for the file esig-0.9.8.2-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.6m, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 780f5af0ed9f217a4a8ebc3e47d2c9c5227977dd3163faad326ed7c7f754a2c6 |
|
MD5 | b68890c07bd20581ca14f97927eda354 |
|
BLAKE2b-256 | 4178061df1e0d37946a2546cda687de6510f6964013ed66e8a23b4ded3a5a0da |
File details
Details for the file esig-0.9.8.2-cp36-cp36m-macosx_10_11_x86_64.whl
.
File metadata
- Download URL: esig-0.9.8.2-cp36-cp36m-macosx_10_11_x86_64.whl
- Upload date:
- Size: 10.1 MB
- Tags: CPython 3.6m, macOS 10.11+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 530fe18fc247fd9d5e290b3cd81fee96e52d98c3e85dce42fcf948619bf91cc3 |
|
MD5 | ef47d08a617c1e2ea204e0d3105dbe81 |
|
BLAKE2b-256 | 54658d627ea03a670322edf3430d363c6714151ca453569021452f42eda799c6 |