pysiglib.sig_combine#
- sig_combine(sig1, sig2, dimension, degree, time_aug=False, lead_lag=False, n_jobs=1)[source]#
Combines two truncated signatures of the same degree and dimension into one signature. In particular, let \(x_1, x_2\) be two paths such that the first point of \(x_2\) is the last point of \(x_1\). Let \(S(x_1), S(x_2)\) be the truncated signatures of \(x_1, x_2\) respectively. Then calling this function on \(S(x_1), S(x_2)\) returns the truncated signature of the concatenated path,
\[S(x_1 * x_2) = S(x_1) \otimes S(x_2),\]where \(x_1 * x_2\) is the concatenation of the two paths \(x_1, x_2\).
- Parameters:
sig1 (numpy.ndarray | torch.tensor) – The first truncated signature
sig2 (numpy.ndarray | torch.tensor) – The second truncated signature. Must have the same degree and dimension as the first.
dimension (int) – Dimension of the underlying space, \(d\).
degree (int) – Truncation level of the signatures, \(N\)
time_aug (bool) – Whether time augmentation was applied before computing the signature.
lead_lag (bool) – Whether the lead lag transformation was applied before computing the signature.
n_jobs (int) – Number of threads to run in parallel. If n_jobs = 1, the computation is run serially. If set to -1, all available threads are used. For n_jobs below -1, (max_threads + 1 + n_jobs) threads are used. For example if n_jobs = -2, all threads but one are used.
- Returns:
Combined signature, \(S(x_1 * x_2)\)
- Return type:
numpy.ndarray | torch.tensor
Example usage:
import pysiglib batch_size = 32 length = 100 dimension = 5 degree = 3 X1 = np.random.uniform(size=(batch_size, length, dimension)) X2 = np.random.uniform(size=(batch_size, length, dimension)) X_concat = np.concatenate((X1, X2), axis=1) X2 = np.concatenate((X1[:, [-1], :], X2), axis=1) # Make sure first pt of X2 is last pt of X1 sig1 = pysiglib.sig(X1, degree) sig2 = pysiglib.sig(X2, degree) # The tensor product... sig_mult = pysiglib.sig_combine(sig1, sig2, dimension, degree) # ... is the same as the signature of the concatenated path: sig = pysiglib.sig(X_concat, degree)
Citation#
If you found this library useful in your research, please consider citing the paper:
@article{shmelev2025pysiglib,
title={pySigLib-Fast Signature-Based Computations on CPU and GPU},
author={Shmelev, Daniil and Salvi, Cristopher},
journal={arXiv preprint arXiv:2509.10613},
year={2025}
}