pysiglib.branched_sig_kernel

pysiglib.branched_sig_kernel#

pysiglib.branched_sig_kernel computes the depth-truncated BCK branched signature kernel for one pair of paths or a batch of path pairs. It uses the same static_kernel interface as pysiglib.sig_kernel, so linear, scaled linear, RBF, Matern, rational quadratic, and custom static kernels can be used.

The depth parameter truncates by rooted-tree depth. The optional dyadic_order parameter controls the finite-difference grid refinement, and return_grid=True returns the final recursion grid instead of only the endpoint value.

branched_sig_kernel(path1, path2, depth, dyadic_order, *, static_kernel=None, time_aug=False, lead_lag=False, end_time=1.0, n_jobs=1, return_grid=False, normalize=False)[source]#

Computes a single branched signature kernel or a batch of branched signature kernels.

This is the non-planar BCK branched rough path kernel of Chevyrev and Oberhauser. It uses the depth recursion K_0 = 1 and K_m = exp(integral K_{m-1} dk) with the same static-kernel increment abstraction as pysiglib.sig_kernel(). The parameter depth truncates forests by tree depth, not by the number of nodes.

Parameters:
  • path1 (numpy.ndarray | torch.Tensor) – First path or batch of paths, shape (..., length_1, dimension).

  • path2 (numpy.ndarray | torch.Tensor) – Second path or batch of paths, shape (..., length_2, dimension).

  • depth (int) – Forest depth truncation for the branched kernel.

  • dyadic_order (int | tuple) – Dyadic refinement order, or a pair of orders.

  • static_kernel (None | pysiglib.StaticKernel) – Static kernel. If None, the linear kernel is used.

  • time_aug (bool) – Whether to time augment the paths.

  • lead_lag (bool) – Whether to apply the lead-lag transformation.

  • end_time (float) – End time for time augmentation.

  • n_jobs (int) – Number of CPU worker threads.

  • return_grid (bool) – If True, returns the final-depth grid.

  • normalize (bool) – If True, normalizes by sqrt(K(x, x) * K(y, y)). Cannot be used with return_grid=True.

Returns:

Branched signature kernel value or final-depth grid.

Return type:

numpy.ndarray | torch.Tensor


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}
}