Skip to content

Signature calculator module

The signature_calculator module implements path signature computation using the roughpy library with Lie increment calculations. Path signatures provide a mathematically rigourous framework for capturing geometric and temporal features of advertising creative performance data, enabling detection of creative fatigue patterns in advertising campaigns.

The module computes signatures as elements of the free Lie algebra, which offers computational efficiency while maintaining the full expressiveness of tensor algebra representations. For a d-dimensional path X:[0,T] → ℝ^d, the signature S(X) encodes:

  • Level 1: Path increments (directional changes)
  • Level 2: Signed areas and path curvature
  • Higher levels: Complex geometric interactions
  • Lie Increments: Uses roughpy with Lie algebra computations rather than tensor products
  • Normalization: All paths are normalized to [0,1]×[0,1] before signature computation
  • Numerical Stability: Adds ε=10^-8 to prevent division by zero for constant metrics
  • Default Parameters:
    • Signature depth: 2 (captures up to quadratic variations)
    • Window size: 7 (weekly patterns in daily data)

Public functions and classes are available under creativedynamics.core.signature_calculator.

from creativedynamics.core.signature_calculator import SignatureCalculator
# Initialize calculator
calc = SignatureCalculator(depth=2)
# Compute signature for a time series
import numpy as np
time_series = np.array([1.0, 1.2, 1.1, 1.3, 1.4, 1.2, 1.0])
signature = calc.compute_signature(time_series)
# The signature is a vector containing Lie increments
# that capture the geometric properties of the path

The computational complexity for signature calculation is O(T·d²) where:

  • T is the length of the time series
  • d is the signature depth
  • This assumes a fixed window size w

This efficiency enables real-time analysis of advertising performance data at scale.