//! Forward-only (filtering) estimates: what the model knew at the time, //! as opposed to the smoothed posteriors `learning_curve` reports. use smallvec::smallvec; use trueskill_tt::{Event, History, Member, Outcome, Team}; /// `games` one-on-one matches at successive times, won by "a" every time. /// /// This is the fixture from issue #19, where `online(true)` reported /// `games * ln(0.5)`. fn repeated_winner(games: i64) -> History { let mut history = History::builder().build(); for time in 1..=games { history .add_events([Event { time, teams: smallvec![ Team::with_members([Member::new("a")]), Team::with_members([Member::new("b")]), ], outcome: Outcome::winner(0, 2), }]) .unwrap(); } history } #[test] fn filtered_evidence_sits_between_coin_flip_and_batch() { let mut history = repeated_winner(5); history.converge().unwrap(); let coin_flip = 5.0 * 0.5f64.ln(); let batch = history.log_evidence(); let filtered = history.filtered_log_evidence(); assert!( filtered > coin_flip, "filtered evidence {filtered} is at or below {coin_flip}, the all-coin-flip \ value the inert online flag reported; game one is a coin flip but games two \ through five are not" ); assert!( filtered < batch, "filtered evidence {filtered} is not below the smoothed {batch}; filtering \ scores each game on strictly less information than smoothing does" ); }