Function cohort_drift

Source
pub fn cohort_drift(
    trajectories: &[(u64, &[(i64, &[f32])])],
    t1: i64,
    t2: i64,
    top_n: usize,
) -> Result<CohortDriftReport, AnalyticsError>
Expand description

Compute cohort-level drift analysis.

Each trajectory in trajectories is (entity_id, sorted_trajectory) where the trajectory uses the standard CVX format &[(i64, &[f32])].

The function finds the nearest vector to t1 and t2 for each entity, computes individual drift vectors, then aggregates cohort statistics.

ยงErrors

Returns AnalyticsError::InsufficientData if fewer than 2 entities have data at both t1 and t2.