Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
Vaardigheden in dit hoofdstuk
- Data and ML — P1002–P1011
The data platform: ingest, store, serve
Land data once, model it in layers, and serve it through a contract you can measure.
A dashboard is only as good as the table behind it, and that table is only as good as the pipeline that filled it. The map that ends the argument has three tiers.
- Ingest: Change streams, Batch drops, Event bus
- Store: Raw zone, Curated tables, Semantic layer
- Serve: Dashboards, Training sets, Operational API
Data quality checks that catch breakage
A check nobody is woken up by is decoration.
A pipeline rarely fails with an error. It fails with a table that is still there, still queryable and wrong.
- Start at the consumer: The table a person reads, not the source system, defines what quality means.
- Five checks, one file: Freshness, volume, nulls, uniqueness and distribution, versioned with the code.
- Fail the job: A warning that exits zero is a comment. The breach must stop the pipeline.
- Route and rehearse: One owner, one runbook, and a fault injected to prove the alert works.
Four numbers that make data trustworthy
Publish four numbers per table, with an owner and a date.
Four numbers decide whether a team trusts a table. None of them is a benchmark; each is a budget you set and publish.
- Freshness: minutes since the newest row reached the consumer, not the source.
- Null rate: share of empty values in the fields the model or dashboard needs.
- Drift: distance between today's inputs and the reference window you froze.
- Cost per query: warehouse spend divided by the queries actually served.
The model lifecycle
A model is a loop, not a launch.
The lifecycle looks like a line and behaves like a loop. Five stages, and the last one sends you back to the first.
- Data and labels: A frozen snapshot, one label definition, a held-out slice.
- Train: Pinned versions, fixed seeds, the exact commit recorded.
- Evaluate: Offline metrics against a baseline, sliced by user group.
- Deploy: Shadow first, then a canary with an automatic rollback rule.
Full note: P1005 — The model lifecycle
A model card people actually read
A card is true for one version of one model on one date, and it should say which.
A model card is not a compliance artefact. It is the page a stranger reads before trusting an output.
- Write for three readers: Risk wants limits, the engineer wants failure modes, the product owner wants the decision.
- Five headings: Intended use, out of scope, data, evaluation and limits, each short enough to read.
- Denominators: Every metric carries the slice, the sample size, the baseline and the date.
- Keep it current: Version it with the model, link it from the registry, and review it at every retrain.
Full note: P1006 — A model card people actually read
Five questions before you ship
Five questions, answered in writing, before the launch.
Five questions separate an evaluation from a demo. Ask them before the launch, not after the incident.
- What decision does the model change, and who owns that decision?
- Which slice fails worst, and how many examples back that number?
- What happens on day one if the input distribution moves?
- Which metric would stop the launch, and who is allowed to call it?
Full note: P1007 — Five questions before you ship
Inside a feature store
One definition, two clocks, and a skew test that runs every day.
A feature store answers one question twice: the same feature, once for training and once for the next request. The layers that make that safe are boring on purpose.
- Event log: Append-only events with an entity key and an event time.
- Sources: Event stream, warehouse tables and partner feeds.
- Transforms: Versioned definitions, tested on a sample before a backfill.
- Offline store: Point-in-time history for training, partitioned by date.
Full note: P1008 — Inside a feature store
LLM cost control without breaking the product
A bill you can explain is a product decision.
An LLM bill grows easily and is hard to explain. The fix is not a cheaper model; it is knowing where tokens went.
- Attribute the bill: One row per call with tenant, feature, model and tokens; retries included.
- Cut context first: Trim retrieval, history and output length, then prove the quality held.
- Route on purpose: A tested rule sends easy work to the small model and logs the choice.
- Guard the spend: Budgets per tenant and feature, a warning at 80 per cent, an honest degraded path.
Full note: P1009 — LLM cost control without breaking the product
Five ways retrieval fails
Test retrieval with questions, not with vibes.
Retrieval fails quietly. The answer is fluent, the citation looks plausible, and the passage that mattered was never in the context.
- Chunking splits the answer in half, and the model never sees the rest.
- The index is stale, so the answer cites last quarter's policy.
- Similarity finds fluent neighbours, not the passage that answers.
- The generator ignores the context and answers from memory.
Full note: P1010 — Five ways retrieval fails
Drift detection from baseline to retire
Drift is a date, not a surprise.
Drift is not a surprise. It is a date on a calendar that nobody wrote down.
- Freeze a reference window: Inputs, labels and metrics, with the query and date that built them.
- Watch the inputs: PSI or KS on the top features, plus null and range checks.
- Watch the outputs: Labels arrive late, so score against a delayed holdout.
- Decide before it fires: A threshold, an owner and a runbook, agreed in advance.