Skip to content

signature_levels_from_increments

from tensorsig.tensor_ops.series import signature_levels_from_increments

Multiply segment exponentials into homogeneous signature levels.

Parameters:

Name Type Description Default
increments Tensor

Floating-point increments shaped (..., steps, width). Any leading batch or window axes are preserved; steps and width must be positive.

required
max_depth int

Maximum homogeneous degree, a positive integer.

required

Returns:

Type Description
list[Tensor]

Non-scalar levels, with level k - 1 shaped (..., width, ..., width) using k trailing width axes.

Source code in src/tensorsig/tensor_ops/series.py
def signature_levels_from_increments(
    increments: Tensor,
    max_depth: int,
) -> list[Tensor]:
    """Multiply segment exponentials into homogeneous signature levels.

    Parameters
    ----------
    increments : Tensor
        Floating-point increments shaped ``(..., steps, width)``. Any leading
        batch or window axes are preserved; steps and width must be positive.
    max_depth : int
        Maximum homogeneous degree, a positive integer.

    Returns
    -------
    list[Tensor]
        Non-scalar levels, with level ``k - 1`` shaped
        ``(..., width, ..., width)`` using ``k`` trailing width axes.
    """
    max_depth = _positive_integer(max_depth, "max_depth")
    if increments.ndim < 2:
        raise ValueError("increments must have shape (..., steps, width).")
    if not increments.dtype.is_floating_point:
        raise ValueError("increments must have a floating-point dtype.")
    steps, width = increments.shape[-2:]
    if steps < 1 or width < 1:
        raise ValueError("increments must have positive step and width axes.")
    leading_shape = increments.shape[:-2]
    flattened = increments.reshape(-1, steps, width)
    levels = batch_restricted_exp(flattened[:, 0], depth=max_depth)
    for increment in flattened[:, 1:].unbind(dim=1):
        levels = _batch_mult_fused_restricted_exp(increment, levels)
    return [level.reshape(*leading_shape, *level.shape[1:]) for level in levels]