← ClaudeAtlas

how-to-feature-to-modellisted

Turn a relational schema into a supervised model that survives production - build point-in-time features that respect each fact's own availability lag, cut the label where the outcome clock has not finished, screen the pipeline for leakage instead of trusting the held-out score, measure against a defensible ceiling and a one-line baseline, and set the decision threshold in money. Use when asked to "predict churn / returns / fraud / conversion", "build an ML model on our data", "why is my AUC so high", "is this feature leaking", "which customers should we intervene on", or when a model that looked good offline is about to ship. Walks the 6-step pipeline and ships four standalone modules - asof, leakcheck, censor, economics - each usable on its own.
phoebefu6/phoebe-data-skills · ★ 1 · AI & Automation · score 72
Install: claude install-skill phoebefu6/phoebe-data-skills
# how-to-feature-to-model Data-Science-layer skill (layer 3 of the phoebe-data-skills 4-layer roadmap). The model is twenty lines. Everything that decides whether it is worth anything happens before and after it: whether each feature could have been known at the moment of the decision, whether the label had time to arrive, whether the score you are celebrating is reachable at all, and whether acting on it pays. Showcase walkthrough (Everrest retail case, real executed charts): `docs/how-to-feature-to-model/` in https://github.com/phoebefu6/phoebe-data-skills ## Where this sits in the lineage `raw dump -> lake -> warehouse -> marts` **-> modelling table -> scored decision**. Reads the clean marts. Clean does not mean modellable: the marts carry duplicate order ids, a status column that is only known after the fact, and an outcome that arrives up to 20 days late. None of that is a data-quality failure. All of it will wreck a model. ## The five rules 1. **Every fact has its own availability lag.** That an order happened is known instantly. Whether it came back is known weeks later. One as-of cutoff for both silently trains on labels that had not been observed. Use `lag_days=0` for activity, a measured maturity window for outcomes. 2. **`groupby(key).label.transform("mean")` is not a feature.** It reads the future and it includes the row's own label. On sparse entities that is most of the signal. Use `asof.add_history`. 3. **Cut the label where the clock ha