# Models: predicting when an artist gets played again ## How airplay actually happens The models should follow how stations really decide what to play: 1. **The playlist decides how often.** Each station has a playlist, split into rotation categories. DR publishes them weekly as A / B / C; roughly, A = several plays a day and C = a few a week. Songs are added and dropped weekly. - DR adds mostly new releases. - NOVA often adds a song only once it reaches the Spotify Top 50. 2. **The scheduler decides when.** Music-scheduling software places songs into clock slots under separation rules: a minimum gap before the same song or artist repeats, plus dayparting (which hours a song may play). 3. **The rest is outside the lists:** specialist shows, guest DJs, recurrent/gold songs, live sessions. Bauer's exact play logs capture these too. So the question splits into three: | Question | Time scale | Data | |---|---|---| | Will the song be added to the playlist, and at which station first? | weeks | rotation PDFs, plays across stations | | While on the list, how often, and when in the day? | hours–days | exact plays | | When does it drop out (and does it come back as a recurrent)? | weeks–months | plays, DR artist weekly history | ## Methods borrowed from finance and insurance | Method | Comes from | Used here for | |---|---|---| | **Hazard / survival models** (Cox proportional hazards, Weibull, competing risks) | company bankruptcy, credit default, life insurance | how long a song stays in rotation; when it gets dropped (the "default"); being added (the competing event is "never added"). Covariates: station, category, artist history, release age, Spotify chart position. | | **Hawkes processes** (self-exciting point processes) | trade arrivals, default contagion, earthquake aftershocks | play times: each play raises the short-term rate, and the decay shows the rotation. A multivariate Hawkes model across stations measures spillover: does a P3 play make a P4 or NOVA play more likely? | | **Inhomogeneous Poisson / renewal processes** with a minimum gap | insurance claims arrivals | inter-play times within a category: a dead time (the separation rule) plus a time-of-day / day-of-week baseline. | | **Regime switching** (hidden Markov models) | currency regimes, bull/bear markets | a song's lifecycle: not on list → new → A rotation → B/C → recurrent → gone. The weekly rotation lists label the states (for DR) and train the model, which can then infer them for Bauer, where nothing is published. | | **Claims-frequency GLMs** (Poisson / negative binomial) | car insurance pricing | weekly play counts per song and station, with the overdispersion real data has. | | **Credibility theory** (Bühlmann / empirical Bayes) | insurance premiums for small portfolios | new or small artists have little history; shrink their estimates towards the station or genre average. | | **Bass diffusion / lead-lag** (Granger) | product adoption, cross-market lead-lag | how a song spreads from one station to the others, and which stations lead. | | **State-space / Kalman filter** | volatility, nowcasting | a smooth "airplay momentum" per artist from noisy daily counts. | ## Evaluating predictions The same way trading models are tested: - **Walk-forward backtests:** fit on the past, predict the next day or week, roll forward. Never fit on the future. - **Scores:** log-likelihood of the observed next-play time (probabilistic forecasts, not single numbers), and calibration ("events predicted at 30% happen 30% of the time"). - **Baselines to beat:** "same as last week", and a per-song average rate. A model that can't beat these isn't worth having. ## Order of work 1. **Collect** (done: daily) and **clean**: artist name normalisation across DR and Bauer, featured artists, track ids across stations. 2. **Describe:** - inter-play distributions per category (they should show the separation gap); - hour-of-day profiles; - list lifetimes from DR's 52-week artist histories. 3. **Baselines**, then **survival models** for list lifetime, and **Hawkes / renewal models** for play times. 4. **Cross-station** models once there are a few months of data. ## What is built (src/model) The first layer follows the design doc's "model we can build now": an **artist × DR channel × week** panel from the DR artist pages (52 Monday–Sunday weeks; the week still running when the pages were read is left out), joined to IFPI chart history by artist name. A chart week counts as known one week after it ends. ``` airplay model panel what the panel holds, rotation thresholds airplay model backtest [--h 1,4,8] [--refit 1] walk-forward backtest -> docs/BACKTEST.md, backtest_scores airplay model rank [--h 4] [--max-h 12] [--top 50] the ranking for h = 1..12 -> forecasts ``` - **"In rotation"** = at least τ_c plays in the week. τ_c is the 75th percentile of each channel's non-zero artist-weeks, and at least 3. It is to be recalibrated on the parsed Friday lists. - **Features** use only what was known at the end of the origin week: - lagged plays on the channel and on the other channels, and weeks since last played; - Track Top-40 and Airplay Top-20 status, recency of the latest chart entry, career chart hits; - from the artist page: Danish, group, gender, career years; - Christmas, Danish × channel, and channel dummies. - **Models**, each fitted directly for each horizon h: - negative binomial for weekly plays (dispersion by maximum likelihood); - logistic regression for "in rotation"; - a local-level Kalman filter on log plays (the "artist form" first version); - the doc's persistence and popularity baselines. - **Backtest:** origins from week 26, refitted weekly. It scores: - log-loss and Brier score on all rows and on adds (rows not in rotation at the origin); - PR-AUC on adds and MAE on plays; - Spearman and NDCG@50 of the artist ranking; - skill against the baselines, with 90% block-bootstrap intervals; - calibration by decile. - **Ranking:** NB means per channel, simulated with one gamma draw per artist shared by all channels. It gives P(rotation) per channel, P(any channel), and total plays with an 80% interval. **Known limits:** - **The artist pool is selected.** Only artists heard on DR in the week the pages were read are in it, so every artist was played at the end of the window, and add rates late in the window are inflated. Widening the pool fixes this: artists from IFPI charts, Bauer logs, featured artists and older plays. - **Not conditioned on a release yet.** The ranking is expected airplay given current form. The release-effect event study needs release dates (Deezer backfill). - **"Release timing only" is not scored yet.** That baseline needs release dates too. - **Christmas is barely seen.** It appears only as lag history (weeks 48–52 of 2025), never as a target week. ## Update 15 Nov 2026: new adds, rotation lists, IFPI test bed - **New adds** (`airplay model adds`, docs/BACKTEST-ADDS.md). The ranking used to show P(artist at or above the play threshold), which is close to 100% for anyone with a current hit. It now shows the chance of a **new add**: entering rotation after at least 4 weeks out, per channel, and on any DR channel after 4 weeks out everywhere, within an 8-week window starting h = 0–12 weeks ahead. Artist-level counts can't tell a new song from an old one returning. But in a week of song-level plays only 3–12% of artists in rotation had two songs in rotation at once, so "drop out, then get added" is the usual pattern. Features include run length on the list and how close the artist is to the threshold. - **Rotation lists** (`airplay rotations [--wayback] [--reparse]`, src/rotations.rs). Parses DR's PDF from glyph positions, with category headers, columns and the P3 summary page; decoration (rotated text) is dropped. Each page's channel comes from where its artists are played. Old lists came from the Wayback Machine's copies of DR's rotation page, giving **29 weekly lists from May 2023 to Nov 2026** in `rotation_lists`. - **Thresholds from the lists** (`airplay model calibrate`, docs/CALIBRATION.md). The six lists inside the DR window put "in rotation" at P3 23, P4 13–15, P5 10, P6 16 and P8 7 plays a week, about three times the old play-distribution guess. Every model now uses these. - **IFPI test bed** (`airplay model ifpi`, docs/IFPI.md): routes and lead–lag per chart period, and a 2010–2026 walk-forward test of Track Top-40 entry → Airplay Top-20 within 8 weeks. ## Update 15 Nov 2026 (later): wider pool, release dates, NMF, Bauer, recalibration - **Artist pool.** The panel no longer holds only artists DR played in one week. DR artist ids now also come from stored artist pages: artists credited on tracks DR has played, and groups an artist belongs to. Band members alone are left out. That's about 8,000 artists, with sources in `dr_artist_sources`. Every artist's page is refreshed weekly, oldest first (daily cap 1,500). - **Release dates.** `deezer_releases` holds every DR artist's Deezer discography (singles, EPs, albums) via `deezer_artists`. The add model gains release recency, releases in the past year, and "releases in the window". The ranking reports P(add | releases in the window), and the blend with P(release) from the artist's two-year release rate (`p_release`). The site has a switch for the two, and a release toggle in the what-if. - **Recalibration.** The add model's probabilities get a Platt map fitted honestly: an inner model trained on windows closed before the last 6 origins predicts those origins. - **NMF.** SuperFridayChart artist pages give every NMF placement per artist since 2022 (`nmf_artist_tracks`), including songs DR never played. Track pages give the countries, fetched for placements inside the modelling window first. Before a track page is read, NMF Denmark is recognised by its follower count. `airplay model nmf` compares DR adds after releases on NMF Denmark, on NMF elsewhere and not on NMF, raw and with controls. - **Bauer.** The site shows each artist's plays per Bauer station over the last 7 days, with songs. Bauer has no lists or history, so Bauer adds join the model once the daily logs cover a few weeks. ## Update 16 Nov 2026: honest backtests Following the external evaluation (`Airplay-Predictor: implementation evaluation`): - **Leak test** (`airplay model leakcheck`): rebuilds every feature from a copy of the data cut at the origin week (`Panel::truncated`) and reports any feature that changes. It found the wave leak (the surge rule confirms an add with the following week). Fixed: "weeks since last add" counts only adds up to t − 1, and training windows close a week before the origin. The test now passes for all features. - **Knowable pool:** an artist enters training, calibration, baselines and test rows only from their first knowable week: first release, DR play, chart entry, DR list, archived play or NMF placement (`Panel::first_known`). 7,219 artists are knowable at the start of the panel, 7,451 by the end, and 485 never. - **Pre-/post-release:** both backtests report the model with the window's NMF placement blended from the artist's history (pre-release, as on the site) and with it known (post-release). - **Release-timing baseline:** add rate by release in the window × weeks since the last release; for release events, by weeks since the previous release. It is weak: the models beat it by +0.4 per channel. - **Recalibration:** pooled out-of-sample Platt and isotonic (`calib.rs`) are compared with the 6-origin Platt. For the release-event model (the site), pooled Platt is best per channel and isotonic for any channel, so the site uses those (`AddModel::fit_events_pooled`), fitted on rolling out-of-sample forecasts over the whole panel. For the window model, the 6-origin Platt is marginally best. All variants still over-predict above about 0.5. - **Intervals:** block bootstrap over 8-week blocks. - **Surge rule vs the lists** (`airplay model addcheck --tune`, docs/ADDCHECK.md): on list pairs at most 8 weeks apart, surge has recall 68% and precision ≥ 25% (F1 0.36), against onset-only 55% / 22%. A grid over the constants moves F1 only within noise, so the defaults stay.