# Rough Path Signature

This app will compute the signature of the path you draw below. Source code.

This app will compute the signature of the path you draw below. Source code.

The truncated signature (5 levels) of the path you've drawn. The signature is a method to summarize a path. It is a collection of iterated integrals. Here, we sample points of your mouse's movement and linearly interpolate between the points to obtain a continuous path and calculate its signature.

For instance, the values under **S1** represent the total displacement
(end point minus starting point) of the drawn path, while
**S2** contains information about
the area enclosed by the path.

The signature has two important properties:

- it is independent of the parametrization of the path;
- it is independent of starting point of the path.

The colors help with visualization by indicating whether a value is negative (blue), neutral (yellow) or positve (red).

The signature is a powerful method to represent data. It has nice properties that can be used for machine learning, for instance in character recognition. See the resources below.

Mathematically, for a continuous path $X \colon [0,1] \to \mathbb{R}^d$ of bounded variation, the signature of $X$ is defined as \[ S(X)_{0,1} = \left (1, \: S^1(X)_{0,1}, \: S^2(X)_{0,1}, \dots \right), \] where \[ S^k(X)_{0,1} = \int_{0 < s_1 < \dots < s_k < 1} \, d X_{s_1} \otimes \dots \otimes d X_{s_k}. \] Here, the integral is taken to be the Stieltjes integral. The signature is an element of the tensor algebra $\bigoplus_{k=0}^\infty \left(\mathbb{R}^{d}\right)^{\otimes k} = \mathbb{R} \oplus \mathbb{R^d} \oplus \left(\mathbb{R^d} \otimes \mathbb{R^d}\right) \oplus \dots$.

In coordinates, we have explicitly \[ S(X)^{i_1,\dots,i_k}_{0,1} = \int_{0 < s_1 < \dots < s_k < 1} \, d X_{s_1}^{i_1} \dots d X_{s_k}^{i_k}, \] in which the indices $i_j$ take value in $\{1, \dots, d\}$.

In our case $d = 2$ and we truncate the signature at level 5. The $k$th level is an element of a vector space of dimension $d^k$, so the $k$th table above contains $2^k$ values. You can hover over the cells to see the corresponding indices.

- An excellent introductory talk on rough paths and signatures by the founder, professor Terry Lyons: Rough Paths, Signatures and the modelling of functions on streams. This tool is based on the one shown in the talk.
- This Github repo is a nice and short getting-started guide for the signature method containing practical Python code. There is also an overview of applications in machine learning.
- For a very accessible introduction to signatures (with overview of applications), see A Primer on the Signature Method in Machine Learning.
- Python package for computing signatures: iisignature. The author has also written a corresponding paper on the algorithms to compute signatures.
- A more comprehensive overview of the theory of signatures can be found in the notes Differential Equations Driven by Rough Paths.
- For an introduction to rough paths, see the book A Course on Rough Paths.
- Source code of this app.