Function discover_motifs

Source
pub fn discover_motifs(
    trajectory: &[(i64, &[f32])],
    window: usize,
    max_motifs: usize,
    exclusion_zone: f32,
) -> Result<Vec<Motif>, AnalyticsError>
Expand description

Discover the top-k recurring motifs in a trajectory.

A motif is the subsequence with the smallest Matrix Profile value (i.e., it has a very similar match elsewhere). We follow the Matrix Profile Index chain to find all occurrences.

§Arguments

  • trajectory — Time-ordered (timestamp, vector) pairs
  • window — Subsequence length
  • max_motifs — Maximum number of motifs to return
  • exclusion_zone — Fraction of window for non-trivial matches (default: 0.5)

§Errors

Returns AnalyticsError::InsufficientData if trajectory too short.