pub fn sample_weights(n: usize) -> Vec<f64>Expand description
Recency weight of each training sample, by its age in the window.
age_i = n - i (i = 0 is the oldest sample, n the window length) and
the half-life is half the window: w_i = 2^(-age_i / (n / 2)). The
newest sample weighs ~1 and the oldest exactly 2^-2 = 0.25, so the
fit concentrates on the recent regime without dropping the older
data entirely and no weight can underflow. Each weight is one
powf, so there is no error accumulation across samples.