pub fn projected(
learner: impl StreamingLearner + 'static,
d_in: usize,
rank: usize,
lambda: f64,
) -> ProjectedLearnerExpand description
Wrap any streaming learner with online projection learning (PAST algorithm).
Applies Welford normalization, then projects d_in-dimensional inputs to
rank dimensions via the PAST subspace tracker (Yang, 1995 — “Projection
approximation subspace tracking”). The forgetting factor lambda controls
the PAST half-life: lambda = 0.9999 ≈ 6 931-sample half-life.
When the inner model exposes RLS readout weights (HasReadout), the
projection updates toward prediction-relevant directions (supervised mode);
otherwise it tracks variance-maximising directions (PCA mode).
§Panics
Panics if rank > d_in (delegated to SubspaceTracker::new).
use irithyll::{projected, rls, StreamingLearner};
let mut model = projected(rls(0.99), 10, 4, 0.9999);
for i in 0..20 {
model.train(&[i as f64; 10], i as f64);
}
let pred = model.predict(&[1.0; 10]);
assert!(pred.is_finite());