Release-event model: 'if the artist releases a new song, will DR add it' trained on clean releases (no other release in the 6 weeks before), with its own walk-forward test; ranking defaults to it and leaves out artists who just released; pool note updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 11:59:58 +00:00
co-authored by Claude Opus 5.5
parent e94601b997
commit 347680bc9e
6 changed files with 229 additions and 34 deletions
+14
View File
@@ -7,6 +7,7 @@
//! airplay model nmf [--out docs/NMF.md] New Music Friday Denmark vs DR adds
//! airplay model synth [--out docs/SYNTH.md] synthetic rotation lists (archive + thresholds)
//! airplay model ifpi the 20-year IFPI test bed -> docs/IFPI.md
//! airplay model events [--out docs/BACKTEST-EVENTS.md] backtest of the release-event model
//! airplay model adds [--h 0,4] [--out docs/BACKTEST-ADDS.md] backtest of the new-add model
//! airplay model rank [--h 4] [--max-h 12] [--top 50]
@@ -82,6 +83,19 @@ pub fn run(db: &Db, args: &[String]) -> Result<()> {
if let Some(out) = arg(args, "--out") { std::fs::write(out, &md)?; }
print!("{md}");
}
Some("events") => {
let tau = common::thresholds(&p, 26);
let mut md = String::new();
let rows = adds::backtest_events(&p, &tau, 26, &mut md)?;
rank::create_tables(db)?;
let at = chrono::Utc::now().format("%Y-%m-%dT%H:%M:%SZ").to_string();
for (m, h, metric, v) in &rows {
db.conn.execute("INSERT OR REPLACE INTO backtest_scores VALUES (?1, ?2, ?3, ?4, ?5)", rusqlite::params![at, m, *h as i64, metric, v])?;
}
let out = arg(args, "--out").unwrap_or_else(|| "docs/BACKTEST-EVENTS.md".into());
std::fs::write(&out, &md)?;
print!("{md}");
}
Some("adds") => {
if let Some(w) = arg(args, "--without") { let _ = adds::WITHOUT.set(w.split(',').map(str::to_string).collect()); }
let horizons: Vec<usize> = arg(args, "--h").unwrap_or_else(|| "0,4".into()).split(',').filter_map(|s| s.trim().parse().ok()).collect();