New-add model (add = entering rotation after 4+ weeks out; per channel and any DR channel, 8-week window), site ranks by it; DR rotation-list PDF parser (glyph positions, channel by play profile) and Wayback Machine backfill: 29 weekly lists 2023-2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+17
-1
@@ -3,8 +3,10 @@
|
||||
//!
|
||||
//! airplay model panel what the panel holds
|
||||
//! airplay model backtest [--h 1,4,8] [--refit 1] [--out docs/BACKTEST.md]
|
||||
//! 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]
|
||||
|
||||
pub mod adds;
|
||||
pub mod backtest;
|
||||
pub mod common;
|
||||
pub mod features;
|
||||
@@ -51,6 +53,20 @@ pub fn run(db: &Db, args: &[String]) -> Result<()> {
|
||||
print!("{}", report.markdown);
|
||||
eprintln!("written to {out}");
|
||||
}
|
||||
Some("adds") => {
|
||||
let horizons: Vec<usize> = arg(args, "--h").unwrap_or_else(|| "0,4".into()).split(',').filter_map(|s| s.trim().parse().ok()).collect();
|
||||
let tau = common::thresholds(&p, 26);
|
||||
let mut md = String::new();
|
||||
let rows = adds::backtest(&p, &tau, &horizons, 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-ADDS.md".into());
|
||||
std::fs::write(&out, &md)?;
|
||||
print!("{md}");
|
||||
}
|
||||
Some("rank") => {
|
||||
let h: usize = arg(args, "--h").and_then(|s| s.parse().ok()).unwrap_or(4);
|
||||
let max_h: usize = arg(args, "--max-h").and_then(|s| s.parse().ok()).unwrap_or(12).max(h);
|
||||
@@ -67,7 +83,7 @@ pub fn run(db: &Db, args: &[String]) -> Result<()> {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
eprintln!("usage: airplay model panel | backtest [--h 1,4,8] [--refit 1] [--out FILE] | rank [--h 4] [--max-h 12] [--top 50]");
|
||||
eprintln!("usage: airplay model panel | backtest [--h 1,4,8] [--refit 1] [--out FILE] | adds [--h 0,4] | rank [--h 4] [--max-h 12] [--top 50]");
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user