### Install Development Version from GitHub Source: https://github.com/bottler/iisignature/blob/main/README.rst Install the most recent development version directly from the GitHub repository using pip. ```bash pip install git+https://github.com/bottler/iisignature ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/bottler/iisignature/blob/main/README.rst Install pre-commit for automatic code formatting and linting if you plan to contribute changes to the project. ```bash pip install pre-commit && pre-commit install ``` -------------------------------- ### Install Released Version Source: https://github.com/bottler/iisignature/blob/main/README.rst Install the latest stable release of the iisignature package using pip. Ensure numpy version 1.17 or higher is installed. ```bash pip install iisignature ``` -------------------------------- ### Example Usage of ParametricSignature1 Source: https://github.com/bottler/iisignature/blob/main/examples/Mathematica/MathematicaSignaturePlaying.txt Demonstrates the usage of the ParametricSignature1 function with specific parametric functions and parameters. ```Mathematica ParametricSignature1[{1 - Cos[#1] &, 1 - Sin[#1] &}, Pi/2, 3] ``` -------------------------------- ### Conditional Installation on macOS Source: https://github.com/bottler/iisignature/blob/main/README.rst If compile errors occur on macOS, try setting the MACOSX_DEPLOYMENT_TARGET environment variable before installing. ```bash MACOSX_DEPLOYMENT_TARGET=10.9 pip install iisignature ``` -------------------------------- ### Get Signature Information Source: https://github.com/bottler/iisignature/blob/main/doc.md Returns a dictionary of properties for a prepared signature object 's', including a list of supported methods. This can be useful for diagnostics. ```python info(s) ``` -------------------------------- ### Generate Signature and Log Signature Source: https://github.com/bottler/iisignature/blob/main/doc.md Generates a random 3D path and computes its signature and log signature up to level 4. Requires numpy and iisignature to be installed. ```python import iisignature import numpy as np path = np.random.uniform(size=(20,3)) signature = iisignature.sig(path,4) s = iisignature.prepare(3,4) logsignature = iisignature.logsig(path,s) ``` -------------------------------- ### Get Basis of Bracketed Expressions Source: https://github.com/bottler/iisignature/blob/main/doc.md Retrieves the basis of bracketed expressions for words up to a certain length and dimension. The output is a tuple of unicode strings representing the bracketed expressions to which the coefficients returned by `logsig` refer. ```python basis(s) ``` -------------------------------- ### info(s) Source: https://github.com/bottler/iisignature/blob/main/doc.md Returns a dictionary of properties of the preparation object, including supported methods. ```APIDOC ## info(s) ### Description If `s` is the result of calling `prepare(d,m[,...])`, then this returns a dictionary of properties of `s`, including a list of methods which it supports. This may be a useful diagnostic. ### Parameters * **s** (object) - The preparation object returned by `prepare()`. ### Returns (dict) - A dictionary of properties of the preparation object. ``` -------------------------------- ### Build Extension and Run Tests Source: https://github.com/bottler/iisignature/blob/main/README.rst Build the C++ extension in-place and run all tests from a local checkout of the repository. ```bash python setup.py build_ext --inplace && python -m unittest discover tests/ ``` -------------------------------- ### prepare(d, m, methods=None) Source: https://github.com/bottler/iisignature/blob/main/doc.md Performs preliminary calculations to produce an object used for computing log signatures. This object is opaque and used as input for other functions. ```APIDOC ## prepare(d, m, methods=None) ### Description Performs preliminary calculations and produces an object which is used for calculating log signatures of *d*-dimensional paths up to level *m*. The object produced is opaque and cannot be pickled. ### Parameters * **d** (integer) - The dimension of the path. * **m** (integer) - The maximum level for the log signature. * **methods** (string, optional) - A string containing letters of the methods to use (e.g., 'CS', 'COSX', 'DH', '2'). 'H' can be added for Hall basis, '2' for signature conversion. ### Returns (object) - An opaque object for log signature calculations. ``` -------------------------------- ### Build Extension In-Place Source: https://github.com/bottler/iisignature/blob/main/README.rst Build the C++ extension directly into the current directory from a local checkout of the repository. ```bash python setup.py build_ext --inplace ``` -------------------------------- ### Prepare for Log Signature Calculation Source: https://github.com/bottler/iisignature/blob/main/doc.md Initializes the necessary structures for calculating a log signature of a given dimension and level. This is the first step before calling `logsig`. ```python s=iisignature.prepare(d,m) ``` -------------------------------- ### Build IISignature PDF Documentation Source: https://github.com/bottler/iisignature/blob/main/doc/README.md Use these commands to build the PDF version of the IISignature documentation from its LaTeX source. Ensure you run pdflatex multiple times to resolve cross-references and table of contents. ```bash pdflatex iisignature biber iisignature pdflatex iisignature pdflatex iisignature ``` -------------------------------- ### Prepare Signature Object for Multi-threading Source: https://github.com/bottler/iisignature/blob/main/doc.md Prepares an object for calculating log signatures. This object is opaque and used as input for other functions. It's fork-safe and can be used across threads, but cannot be pickled. On Windows, it's run separately in each background thread. ```python import iisignature, threading def f(): global s s=iisignature.prepare(2,10,"CS") t = threading.Thread(target=f) t.start() #slow activity: theano.function, another prepare(), # keras compile, ... t.join() ``` -------------------------------- ### logsig(path, s, methods=None) Source: https://github.com/bottler/iisignature/blob/main/doc.md Computes the log signature of a d-dimensional path up to level m, using a pre-calculated preparation object. ```APIDOC ## logsig(path, s, methods=None) ### Description Computes the log signature of the *d*-dimensional path `path` up to level *m*, returned as a `numpy` array. The `s` parameter is the result of calling `prepare(d,m[,...])`. ### Parameters * **path** (numpy.ndarray) - The input path. * **s** (object) - The preparation object returned by `prepare()`. * **methods** (string, optional) - A string specifying the calculation method (e.g., 'C', 'O', 'S', 'A', 'X'). If 'X' is used, the output shape changes. ### Returns (numpy.ndarray) - The log signature of the path. ``` -------------------------------- ### version Source: https://github.com/bottler/iisignature/blob/main/doc.md Returns the version number of the iisignature library. ```APIDOC ## version() ### Description Return the version number of `iisignature`. ### Method Not applicable (Python function call) ### Parameters None ### Response - **version** (string) - The version number of the library. ``` -------------------------------- ### Prepare for 2D Rotational Invariants Source: https://github.com/bottler/iisignature/blob/main/doc.md Prepares an object for calculating linear rotational invariants of 2D path signatures up to a specified level. The 'type' parameter influences the selection of invariants. ```python s = iisignature.rotinv2dprepare(m, "a") ``` -------------------------------- ### logsigbackprop(derivs, path, s, methods=None) Source: https://github.com/bottler/iisignature/blob/main/doc.md Calculates the derivatives of a scalar function with respect to a path, given the derivatives with respect to its log signature. ```APIDOC ## logsigbackprop(derivs, path, s, methods=None) ### Description Returns the derivatives of some scalar function *F* with respect to `path`, given the derivatives of *F* with respect to `logsig(path, s, methods)`. Returns an array of the same shape as `path`. ### Parameters * **derivs** (numpy.ndarray) - Derivatives of F with respect to the log signature. * **path** (numpy.ndarray) - The input path. * **s** (object) - The preparation object returned by `prepare()`. * **methods** (string, optional) - The methods supported are 'S' and 'A' (defaults) and 'X'. If 'X' is not requested, and 'A' is inapplicable, and `s` does not support 'S', then `s` is modified to support 'S'. ### Returns (numpy.ndarray) - The derivatives with respect to the path. ``` -------------------------------- ### basis(s) Source: https://github.com/bottler/iisignature/blob/main/doc.md Returns the basis of bracketed expressions for words of a given length and number of letters, based on a preparation object. ```APIDOC ## basis(s) ### Description Returns the basis of bracketed expressions given as a tuple of unicode strings, for words of length no more than *m* on *d* letters, where `s` is the result of calling `prepare(d,m[,...])`. These are the bracketed expressions which the coefficients returned by `logsig` refer to. ### Parameters * **s** (object) - The preparation object returned by `prepare()`. ### Returns (tuple) - A tuple of unicode strings representing the basis. ``` -------------------------------- ### rotinv2dprepare(m, type) Source: https://github.com/bottler/iisignature/blob/main/doc.md Prepares for finding linear rotational invariants of signatures up to level `m` of 2D paths. Returns an opaque object used by other functions in this section. `m` should be a small even number, and `type` can be 'a', 's', 'q', or 'k' to control the type of invariants returned. ```APIDOC ## rotinv2dprepare(m, type) ### Description This prepares the way to find linear rotational invariants of signatures up to level `m` of 2d paths. The returned opaque object is used (but not modified) by the other functions in this section. `m` should be a small even number. `type` should be "a" if you want to return **a**ll the invariants. Some invariants do not add information, because their values are products of other invariants. Set `type` to "s" if you want to exclude them. Internally, at each level, a basis for the invariant subspace with the known elements quotiented out is found using **s**ingular value decomposition from `numpy`. The exact result in this case is not guaranteed to be stable between versions. (An alternative, potentially faster, method of doing the same calculation uses the **Q**R decomposition as provided by `scipy`. You can get this by setting `type` to "q". This will only work if you have `scipy` available, and may generate a strange but harmless warning message.) (In addition, setting `type` to "k" means that *only* the invariants which are already **k**nown based on lower levels will be returned. This is used for testing.) If *m* exceeds 10 this function can take a lot of time and memory. ``` -------------------------------- ### Log Signature to Signature Backpropagation Source: https://github.com/bottler/iisignature/blob/main/doc.md Computes the derivatives of a scalar function with respect to a log signature, given the derivatives with respect to its converted signature. Returns an array of the same shape as the log signature. ```python logsigtosigbackprop(derivs, logsig, s) ``` -------------------------------- ### logsiglength(d, m) Source: https://github.com/bottler/iisignature/blob/main/doc.md Calculates the length of the log signature up to level m of a d-dimensional path using Witt's formula. ```APIDOC ## logsiglength(d, m) ### Description Calculates the length of the log signature up to level *m* of a *d*-dimensional path. This value can be calculated using Witt's formula. ### Parameters * **d** (integer) - The dimension of the path. * **m** (integer) - The maximum level for the log signature. ### Returns (integer) - The length of the log signature. ``` -------------------------------- ### Calculate Log Signature Backpropagation Source: https://github.com/bottler/iisignature/blob/main/doc.md Computes the derivatives of a scalar function with respect to a path, given derivatives with respect to its log signature. Supports 'S', 'A', and 'X' methods. Modifies 's' to support the 'S' method if necessary. ```python logsigbackprop(derivs, path, s, methods=None) ``` -------------------------------- ### Calculate Log Signature Source: https://github.com/bottler/iisignature/blob/main/doc.md Computes the log signature of a path using pre-initialized structures. This function is typically called after `prepare`. ```python logsignature=iisignature.logsig(p,s) ``` -------------------------------- ### Calculate Signature Numerically (Mathematica) Source: https://github.com/bottler/iisignature/blob/main/examples/Mathematica/README.rst This script calculates the signature of a path numerically, analogous to the iisignature.sig function. ```Mathematica (* calcSignature.wl *) ``` -------------------------------- ### logsigtosigbackprop(derivs, logsig, s) Source: https://github.com/bottler/iisignature/blob/main/doc.md Calculates derivatives with respect to a log signature, given derivatives with respect to its corresponding signature. ```APIDOC ## logsigtosigbackprop(derivs, logsig, s) ### Description Returns the derivatives of some scalar function *F* with respect to `logsig`, given the derivatives of *F* with respect to `logsigtosig(logsig, s)`. Returns an array of the same shape as `logsig`. ### Parameters * **derivs** (numpy.ndarray) - Derivatives of F with respect to the signature. * **logsig** (numpy.ndarray) - The input log signature. * **s** (object) - The preparation object returned by `prepare()`. ### Returns (numpy.ndarray) - The derivatives with respect to the log signature. ``` -------------------------------- ### Signature of a Primitive Quadratic Bezier Curve Source: https://github.com/bottler/iisignature/blob/main/examples/Mathematica/MathematicaSignaturePlaying.txt Calculates the signature for a primitive quadratic Bezier curve using the ParametricSignature1 function. ```Mathematica ParametricSignature1[{#1^2 &, (1 - #1)^2 &}, 1, 5] ``` -------------------------------- ### Signatures of Parametric Curves (Mathematica) Source: https://github.com/bottler/iisignature/blob/main/examples/Mathematica/README.rst This file contains Mathematica code for computing the signatures of parametric curves. ```Mathematica (* parametricCurves.wl *) ``` -------------------------------- ### Lie Algebra Basis Calculations (Mathematica) Source: https://github.com/bottler/iisignature/blob/main/examples/Mathematica/README.rst This Mathematica script performs calculations related to free Lie algebra bases. ```Mathematica (* bases.wl *) ``` -------------------------------- ### Calculate Log Signature of a Path Source: https://github.com/bottler/iisignature/blob/main/doc.md Computes the log signature of a d-dimensional path up to level m. The result is a numpy array. It uses a default calculation method or a specified one. The 'X' method requires explicit request and changes the output shape. ```python logsig(path, s, methods=None) ``` -------------------------------- ### siglength Source: https://github.com/bottler/iisignature/blob/main/doc.md Calculates the length of the signature for a given path dimension and level. ```APIDOC ## siglength(d, m) ### Description The length of the signature up to level *m* of a *d*-dimensional path. ### Method Not applicable (Python function call) ### Parameters - **d** (int) - The dimension of the path. - **m** (int) - The maximum level of the signature. ### Response - **length** (int) - The calculated signature length. ``` -------------------------------- ### Convert Log Signature to Signature Source: https://github.com/bottler/iisignature/blob/main/doc.md Converts a log signature to its corresponding signature. The digit '2' must be included in the methods string when preparing 's'. ```python logsigtosig(logsig, s) ``` -------------------------------- ### Unit Circle Signature Reference (Mathematica) Source: https://github.com/bottler/iisignature/blob/main/examples/Mathematica/README.rst This Mathematica code provides the signature of the unit circle up to level 6 for reference purposes. ```Mathematica (* circleExample.wl *) ``` -------------------------------- ### sigbackprop Source: https://github.com/bottler/iisignature/blob/main/doc.md Performs the backpropagation calculation for derivatives through the `sig` function. ```APIDOC ## sigbackprop(s, path, m) ### Description Performs the basic calculation necessary to backpropagate derivatives through the `sig` function. If `path` has shape `(...,n,d)` and derivatives with respect to `sig(X,m)` are in `s`, this function returns derivatives with respect to `path`. ### Method Not applicable (Python function call) ### Parameters - **s** (numpy.ndarray) - Array of derivatives with respect to the signature, shape `(...,siglength(d,m))`. - **path** (numpy.ndarray) - The input path, shape `(...,n,d)`. - **m** (int) - The maximum level of the signature. ### Response - **derivatives** (numpy.ndarray) - The computed derivatives with respect to the path, shape `(...,n,d)`. ``` -------------------------------- ### sigjacobian Source: https://github.com/bottler/iisignature/blob/main/doc.md Calculates the Jacobian matrix of the `sig` function with respect to the input path. ```APIDOC ## sigjacobian(path, m) ### Description Provides the Jacobian matrix of the `sig` function with respect to `path`. If `path` has shape `(n,d)`, an array of shape `(n,d,siglength(d,m))` is returned. ### Method Not applicable (Python function call) ### Parameters - **path** (numpy.ndarray) - The input path, typically of shape `(n,d)`. - **m** (int) - The maximum level of the signature. ### Response - **jacobian** (numpy.ndarray) - The Jacobian matrix. ``` -------------------------------- ### rotinv2dcoeffs(s) Source: https://github.com/bottler/iisignature/blob/main/doc.md Retrieves the basis vectors for the rotational invariants computed by the process defined by `s`. The `s` parameter is an object prepared by `rotinv2dprepare`. ```APIDOC ## rotinv2dcoeffs(s) ### Description The basis of rotational invariants which are found by the calculation defined by `s`, where `s` is the result of calling `rotinv2dprepare(...)`. The result is given as a tuple of 2d `numpy` arrays, where each row of element `i` is an element of the basis within level (2i+2) of the signature. ``` -------------------------------- ### rotinv2d(path, s) Source: https://github.com/bottler/iisignature/blob/main/doc.md Computes the rotational invariants of the signature of a 2-dimensional path up to a specified level. The `s` parameter is an object prepared by `rotinv2dprepare`. ```APIDOC ## rotinv2d(path, s) ### Description The rotational invariants of the signature of the 2-dimensional path `path` up to level *m*, where `s` comes from `rotinv2dprepare(m,...)`. The result is returned as a `numpy` array of shape `(...,rotinv2dlength(s))`. ``` -------------------------------- ### logsigtosig(logsig, s) Source: https://github.com/bottler/iisignature/blob/main/doc.md Converts a log signature to its corresponding signature. ```APIDOC ## logsigtosig(logsig, s) ### Description If `s` is the result of calling `prepare(d,m,methods)`, and `logsig` (shape `(...,logsiglength(d,m))`) is a logsignature, then returns the corresponding signature with shape `(...,siglength(d,m))`. The digit `2` must be included in `methods` during preparation. ### Parameters * **logsig** (numpy.ndarray) - The input log signature. * **s** (object) - The preparation object returned by `prepare()`. ### Returns (numpy.ndarray) - The corresponding signature. ``` -------------------------------- ### rotinv2dlength(s) Source: https://github.com/bottler/iisignature/blob/main/doc.md Returns the number of rotational invariants that will be computed by the process defined by `s`. The value of `s` is determined by a prior call to `rotinv2dprepare`. ```APIDOC ## rotinv2dlength(s) ### Description The number of rotational invariants which are found by the calculation defined by `s`, where `s` is the result of calling `rotinv2dprepare(m,type)`. When the type is `"a"`, this is just Σ(i=1,…,m/2) C(2i, i). In common cases, the result is given in this table: | `m` | `"a"` | `"s"` | `"k"` | |----:|------:|------:|------:| | 2 | 2 | 2 | 0 | | 4 | 8 | 5 | 3 | | 6 | 28 | 15 | 15 | | 8 | 98 | 46 | 76 | | 10 | 350 | 154 | 336 | | 12 | 1274 | 522 | 1470 | | 14 | 4706 | 1838 | 6230 | ``` -------------------------------- ### sig Source: https://github.com/bottler/iisignature/blob/main/doc.md Computes the iterated-integral signature of a path up to a specified level. ```APIDOC ## sig(path, m, format=0) ### Description Computes the signature of the *d*-dimensional path `path` up to level m. The output is a `numpy` array. ### Method Not applicable (Python function call) ### Parameters - **path** (numpy.ndarray) - The input path, typically of shape `(...,n,d)`. - **m** (int) - The maximum level of the signature. - **format** (int, optional) - Controls the output format. Defaults to 0. - `0`: Returns a single numpy array of shape `(...,siglength(d,m))`. - `1`: Returns a list of numpy arrays, one for each level. - `2`: Returns signatures for all partial paths from the start to each point. ### Response - **signature** (numpy.ndarray or list) - The computed signature(s) based on the `format` parameter. ``` -------------------------------- ### Calculate 2D Rotational Invariants Source: https://github.com/bottler/iisignature/blob/main/doc.md Computes the rotational invariants of a 2D path's signature up to a level determined by the prepared object 's'. The result is a numpy array. ```python invariants = iisignature.rotinv2d(p, s) ``` -------------------------------- ### ApplyLowestLevel Function in Mathematica Source: https://github.com/bottler/iisignature/blob/main/examples/Mathematica/MathematicaSignaturePlaying.txt Applies a function to the lowest level of a nested list structure. Useful for evaluating functions within a nested list at a specific value. ```Mathematica ApplyLowestLevel[ff_, x_] := Last@Outer[Apply[#2, #1] &, {{x}}, ff, 1, Infinity] ``` -------------------------------- ### ParametricSignature1 Function in Mathematica Source: https://github.com/bottler/iisignature/blob/main/examples/Mathematica/MathematicaSignaturePlaying.txt Calculates the signature of a parametric curve up to a specified level. The zeroth level is included in the calculation. ```Mathematica ParametricSignature1[f_, u_, m_]:=ApplyLowestLevel[NestList[Outer[Function[x, Integrate[#[t] Derivative[1][#2][t], {t, 0, x}]]& , #, f]& , {1& }, m], u] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.