NMF Denmark in the add model (placed in the window, top 10, history), scenario type (release / NMF) for the ranking and the what-if; NMF Denmark export

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 11:43:52 +00:00
co-authored by Claude Opus 5.5
parent e6b080246b
commit e94601b997
6 changed files with 268 additions and 151 deletions
+11 -3
View File
@@ -7,7 +7,7 @@
//! independent. Not yet conditioned on a release at t + h: that needs the release-effect curve
//! from release dates (Deezer backfill). Until then this ranks expected airplay given current form.
use super::adds::{AddModel, Rot};
use super::adds::{AddModel, Rot, Scenario};
use super::common::{thresholds, Direct, Rng};
use super::features::P;
use super::panel::{Panel, C, CHANNELS};
@@ -123,8 +123,14 @@ pub fn run(db: &Db, p: &Panel, max_h: usize, show_h: usize) -> Result<Vec<Line>>
let id = &p.artists[a].id;
// If they release in the window, if they don't, and blended by their release rate.
let t0 = p.w() - 1;
let (pc1, pa1) = m.predict(p, &rot, a, t0, Some(true), None);
let (pc0, pa0) = m.predict(p, &rot, a, t0, Some(false), None);
// If they release: placed on NMF Denmark or not, weighted by how often the artist's
// releases were placed; if they don't release: no NMF placement.
let q = super::adds::p_nmf(p, a, t0);
let (pcn, pan) = m.predict(p, &rot, a, t0, Scenario::new(true, true), None);
let (pcr, par) = m.predict(p, &rot, a, t0, Scenario::new(true, false), None);
let (pc0, pa0) = m.predict(p, &rot, a, t0, Scenario::new(false, false), None);
let pc1: [f64; C] = std::array::from_fn(|c| q * pcn[c] + (1.0 - q) * pcr[c]);
let pa1 = q * pan + (1.0 - q) * par;
let pr = super::adds::p_release(p, a, t0);
let mix = |p1: f64, p0: f64| match pr { Some(r) => r * p1 + (1.0 - r) * p0, None => p0 };
let none = Option::<f64>::None;
@@ -132,6 +138,8 @@ pub fn run(db: &Db, p: &Panel, max_h: usize, show_h: usize) -> Result<Vec<Line>>
origin.to_string(), start, prob, none, none, none]);
put("add_any", "any", mix(pa1, pa0))?;
put("add_any_rel", "any", pa1)?;
put("add_any_nmf", "any", pan)?;
put("p_nmf", "any", q)?;
if let Some(r) = pr { put("p_release", "any", r)?; }
for c in 0..C {
put("add", CHANNELS[c], mix(pc1[c], pc0[c]))?;