Name | esig JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | This package provides "rough path" tools for analysing vector time series. |
upload_time | 2024-12-17 14:03:57 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
data streams
rough paths
signatures
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# esig
The Python package [esig](https://pypi.org/project/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](https://github.com/terrylyons/libalgebra) C++ library.
[](https://github.com/datasig-ac-uk/esig/actions/workflows/build.yml)
## 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](https://esig.readthedocs.org/en/latest).
## 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.
```python3
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.
```python3
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.
```python3
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.
```python3
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
```python3
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.
Raw data
{
"_id": null,
"home_page": null,
"name": "esig",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Sam Morley <info@datasig.ac.uk>",
"keywords": "data streams, rough paths, signatures",
"author": null,
"author_email": "Terry Lyons <software@lyonstech.net>",
"download_url": "https://files.pythonhosted.org/packages/34/55/972a2ec51b455bcddf633632abc7e7777e701f38fd2d8551c394632925fc/esig-1.0.0.tar.gz",
"platform": null,
"description": "# esig\nThe Python package [esig](https://pypi.org/project/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](https://github.com/terrylyons/libalgebra) C++ library.\n\n[](https://github.com/datasig-ac-uk/esig/actions/workflows/build.yml)\n\n## Installation\nesig can be installed from a wheel using pip in most cases.\nThe wheels contain all of the dependencies and thus make it easy to use the package.\nFor example, on Python 3.8, you can install esig using the following console command:\n```\npython3.8 -m pip install esig\n```\n(You may need to tweak this command based on your platform, Python version, and preferences.)\n\nesig can be compiled from source, but this is not advised.\nMore information can be found in the [documentation](https://esig.readthedocs.org/en/latest).\n\n## Basic usage\nesig provides a collection of basic functions for computing the signature of a data stream in the form of a Numpy array.\nThe `stream2sig` function computes the signature of a data stream up to a specific depth.\nFor example, we can create a very simple data stream and compute its signature as follows.\n```python3\nimport numpy as np\nimport esig\n\nstream = np.array([\n [1.0, 1.0],\n [3.0, 4.0],\n [5.0, 2.0],\n [8.0, 6.0]\n])\ndepth = 2\n\nsig = esig.stream2sig(stream, depth) # compute the signature\nprint(sig) # prints \"[1.0, 7.0, 5.0, 24.5, 19.0, 16.0, 12.5]\"\n```\nThe 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.\nThis first element is always 1.0, which corresponds to the empty tensor key.\nIn 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).\nThese are the depth 1 words.\nThe final 4 elements are the depth 2 words (1,1), (1,2), (2,1), and (2,2).\nesig provides the `sigkeys` function to generate these labels for you based on the parameters of the data.\n```python3\nwidth = 2\nsig_keys = esig.sigkeys(width, depth)\nprint(sig_keys) # prints \" () (1) (2) (1,1) (1,2) (2,1) (2,2)\"\n```\nTo compute the log signature of a data stream you use the `stream2logsig` function.\nThis 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.\n```python3\nlog_sig = esig.stream2logsig(stream, depth)\nprint(log_sig) # prints \"[7. 5. 1.5]\"\n```\nHere 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\\].\nAgain, esig provides a utility function `logsigkeys` for getting the keys that correspond to the coefficients in order for the log signature.\n```python3\nlog_sig_keys = esig.logsigkeys(width, depth)\nprint(log_sig_keys) # prints \" 1 2 [1,2]\"\n```\nThere are two additional utility functions for computing the size of a signature or logsignature with a specified dimension and depth: `sigdim` and `logsigdim`.\nThese functions return an integer that is the dimension of the Numpy array returned from the `stream2sig` or `stream2logsig` functions, respectively.\n\nesig 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.\nIn particuar, the expected value over the ensemble with respect to the new measure agrees with that of the original measure.\n\n### Using alternative computation backends\nesig uses libalgebra as a backend for computing signatures and log signatures\n by default.\nHowever, the computation backend can be changed to instead use an alternative\n library for computing signatures and log signatures.\nThis is achieved by using the `set_backend` function in esig and providing\n the name of the backed that you wish to use.\nFor example, we can switch to using the `iisignature` package as a backend by\n first installing the `iisignature` package and then using the command\n```python3\nimport esig\nesig.set_backend(\"iisignature\")\n```\nTo make it easier to install and use `iisignature` as a backend, it is\n offered as an optional extra when installing esig:\n```\npython3.8 -m pip install esig[iisignature]\n```\nYou can also define your own backend for performing calculations by creating\n a class derived from `esig.backends.BackendBase`, implementing the methods\n `describe_path` (log_signature) and `signature` and related methods.\n",
"bugtrack_url": null,
"license": null,
"summary": "This package provides \"rough path\" tools for analysing vector time series.",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://esig.readthedocs.io/en/latest",
"Source code": "https://github.com/datasig-ac-uk/esig"
},
"split_keywords": [
"data streams",
" rough paths",
" signatures"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f3509053ce316bd2e501d463e3447e26ce8f42b0f37d5cdc92c52faffba49f35",
"md5": "617bcb697a6caf00ed57b32dda6c2468",
"sha256": "370d7f3f5c5a8466be8db548c3c7ce35868f6c5f69a81fdcd9f57b4e1cf48c0d"
},
"downloads": -1,
"filename": "esig-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "617bcb697a6caf00ed57b32dda6c2468",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 19620,
"upload_time": "2024-12-17T14:03:55",
"upload_time_iso_8601": "2024-12-17T14:03:55.151158Z",
"url": "https://files.pythonhosted.org/packages/f3/50/9053ce316bd2e501d463e3447e26ce8f42b0f37d5cdc92c52faffba49f35/esig-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3455972a2ec51b455bcddf633632abc7e7777e701f38fd2d8551c394632925fc",
"md5": "65c298a92663bce8d62384a723f2804b",
"sha256": "b34e74d0a7378beb1df616480573057eef4ab4cd227b1a89a446559abc3439bc"
},
"downloads": -1,
"filename": "esig-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "65c298a92663bce8d62384a723f2804b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 29984,
"upload_time": "2024-12-17T14:03:57",
"upload_time_iso_8601": "2024-12-17T14:03:57.045023Z",
"url": "https://files.pythonhosted.org/packages/34/55/972a2ec51b455bcddf633632abc7e7777e701f38fd2d8551c394632925fc/esig-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 14:03:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "datasig-ac-uk",
"github_project": "esig",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "esig"
}