Part F · Chapter 32 · The platform on Azure, streaming and AI

32. Data for machine learning

A model is only as good as the data it learned from and the data it is given in production. Compute features as they stood at the time, freeze the training set as a version you can rebuild, compute features the same way for training and scoring, and keep the lineage back to the source and to people's choices about their data.

Model scores drifting when training and serving compute features differently
Playback speed

The clip follows Harbour Mutual's fraud model. Claims and policies in silver, and the CRM's flag of the customers who said no to their data training models. Three features computed as they stood on the day each claim was reported. Training set v1 frozen with its fingerprint, the opted-out customers' claims left out. Then production: the claims system's own code computes two features differently, every production claim's score drifts upward and more claims are flagged. A feature store gives training and scoring one definition, and the scores fall back in line. Last, the lineage from the model back to the source columns in three systems and the consent flag.

The idea: the model learns what the data says

Harbour Mutual's fraud team wants a model that flags suspicious claims as they are reported. Alex does not build the model; Alex builds what it stands on. Four ideas carry it:

  • Features from silver. A feature is a number the model reads, such as the customer's prior claims. It is computed from silver, where the data is typed, de-duplicated and conformed, never from raw files or from a report.
  • Point in time. Each feature is computed as it stood when the prediction would have been made: the day the claim was reported. A feature that reads anything learned later, such as the final payment or the rejection, leaks the future: the model looks brilliant in training and fails in production.
  • A versioned training set. The rows the model learned from are frozen as a data product with a version: a cut-off, the feature definitions and a fingerprint of the rows. Built again next year, it gives the same rows, so the model can be explained and retrained.
  • One definition for training and serving. When production computes a feature differently from training, the model's inputs move while the model stays the same: training/serving skew. A feature store keeps one definition of each feature and serves the same values to both.
Consent as data Whether a customer's data may train a model is a fact about that customer, so it belongs in the data: a flag in the CRM that the training set reads, and that the lineage shows. A choice that lives only in a policy document cannot be checked.
Remember Compute each feature once, as it stood at the time, and serve that same value to training and to scoring; freeze the training set as a version, and keep the lineage to the source and to the consent.

A worked example: the fraud model's training set

Training set v1 holds the 30 claims reported up to 2025-06-30, without the 9 claims of customers who said no to model training. Its fingerprint is 06253112: built on 2025-07-01 and again on 2026-10-18, the rows are the same.

Training set v1: features point in time, the label from the claim documents, opted-out customers left out (PostgreSQL)
WITH opted_out(customer_id) AS (VALUES (4), (13), (22), (31), (40)),
claim_facts AS (
    SELECT c.claim_id, c.claim_number, p.customer_id, p.start_date, c.loss_date, c.reported_date
    FROM claims c JOIN policies p ON p.policy_id = c.policy_id
)
SELECT f.claim_number,
    (SELECT COUNT(*) FROM claim_facts o
     WHERE o.customer_id = f.customer_id AND o.claim_id <> f.claim_id
       AND o.reported_date < f.reported_date AND o.reported_date >= f.reported_date - 365) AS prior_claims,
    f.loss_date - f.start_date AS policy_age_days,
    f.reported_date - f.loss_date AS report_delay_days,
    COALESCE((d.doc ->> 'fraud_flag')::BOOLEAN, FALSE) AS fraud
FROM claim_facts f
LEFT JOIN claim_documents d ON d.claim_id = f.claim_id
WHERE f.reported_date <= DATE '2025-06-30'
  AND f.customer_id NOT IN (SELECT customer_id FROM opted_out)
ORDER BY f.claim_id
The scorecard standing in for the trained model
FeaturePoints
prior_claims25 a claim, at most 3
policy_age_days30 when under 60
report_delay_days20 when over 30

In production, 21 claims arrived after the cut-off. Scored with the features as training defined them, 6 are flagged; scored with the claims system's own calculation, 13. Nobody changed the model: the serving code counts the claim being scored among the prior claims, and measures the policy's age to the report date instead of the loss.

Try this In the Lineage explorer, trace claims.loss_date forward: everything that reads it, as two of the model's features do, breaks or drifts when it changes.

Why it matters for Alex

When a model flags the wrong claims, the first question is never about the algorithm; it is "what was it trained on, and what is it given now?" With point-in-time features, a versioned training set and one definition in a feature store, Alex can answer both in an afternoon. Without them, nobody can rebuild what the model learned, and a customer who said no cannot be shown to have been left out.

The EU AI Act behind this chapter If a model is classed as high-risk under the EU AI Act, the practices in this chapter are also obligations of the organisation that builds it. The rules below are summarised, not quoted; whether one applies to a given model is for your legal team to decide, and this is not legal advice.
What the EU AI Act asks, summarised, and where it is written
ObligationIn shortWhere it is written
Which insurance models are high-riskAI systems intended for risk assessment and pricing in relation to natural persons in life and health insurance are high-risk; the list names no other insurance lines, and it excludes fraud detection only from its credit-scoring point.EU AI Act (Regulation (EU) 2024/1689), Annex III, point 5(c), read with Article 6(2); fraud exclusion in point 5(b)
Governed training dataTraining, validation and testing data of a high-risk system follow data governance practices (design choices, collection and origin, preparation such as labelling and cleaning, examination for bias), and are relevant, sufficiently representative and, as far as possible, free of errors and complete for the intended purpose.EU AI Act, Article 10(2) and (3)
Datasheets for the training dataThe technical documentation of a high-risk system describes its training data sets: their provenance, scope and main characteristics, how the data was obtained and selected, and how it was labelled and cleaned.EU AI Act, Article 11(1) and Annex IV, point 2(d)
Logs over the system's lifetimeA high-risk system technically allows the automatic recording of events (logs) over its whole lifetime, for traceability.EU AI Act, Article 12(1)
When the high-risk duties applyThe obligations for high-risk systems listed in Annex III apply from 2 December 2027; the regulation as first adopted set 2 August 2026, and the date was moved by the Digital Omnibus on AI.EU AI Act, Article 113, as amended by Regulation (EU) 2026/1744

Where it goes wrong

  • Features from today's tables. The final payment or the claim's status used as a feature: perfect in training, useless when the claim is reported.
  • A training set nobody can rebuild. "The last twelve months" queried again next year gives different rows, and the model cannot be explained.
  • Two teams, two calculations. The data scientists' notebook and the claims system's code compute the same feature differently, and the scores drift without anyone changing the model.
  • Consent in a document. A list of customers who opted out, kept in a spreadsheet the pipeline never reads.

Exercises

The lab checks each one against facts written down in advance, so any answer the brief allows passes. A pass is kept in this browser.

Point in time, or a leak?

For each candidate feature of the fraud model, decide whether it is safe to train on or leaks the future.

Prior claims in 365 days: The customer's claims reported in the 365 days before this one was reported
Policy age at the loss: Days from the policy's start to the loss
The policy's claims in its year: Every claim on the same policy, whenever it was reported
Total paid on the claim: The sum of the claim's payments
Claim rejected: 1 when the claim's status is rejected
Days to report: Days from the loss to the day it was reported

Can the training set be rebuilt?

For each recipe, decide whether the training set it makes can be rebuilt from its version, giving the same rows on another day.

Claims reported up to 30 June 2025, each feature as it stood on the day the claim was reported
Claims reported in the twelve months before the day it is built, features as on the day each was reported
Claims reported up to 30 June 2025, features computed with everything known on the day it is built
The first recipe built a year later, from the claims system's history as it stands then

Find the skew and its cause

Production scores have drifted. Compare each feature as training computed it with the claims system's value for the same production claims, and name what is different.

prior_claims
policy_age_days
report_delay_days

Who is in training set v1?

Training set v1 takes the claims reported up to 2025-06-30, without the claims of customers who said no to model training (customers 4, 13, 22, 31, 40). Decide for each claim.

CL-2024-00004: customer 16, reported 2024-10-09
CL-2024-00002: customer 40, reported 2024-01-31
CL-2025-00001: customer 26, reported 2025-10-03
CL-2024-00014: customer 22, reported 2024-12-31
CL-2023-00024: customer 3, reported 2023-11-06
CL-2025-00012: customer 25, reported 2025-12-23

On Azure

Checked against Microsoft's documentation on 18 October 2026.

The same pieces on Azure:

  • Azure Databricks: Databricks Feature Store in Unity Catalog. Features are feature tables (Delta tables with a primary key) or declarative Feature Views; point-in-time joins build training sets as of each label's time; a model trained on them records its lineage to the features and looks up the same features when it serves, from the Online Feature Store (built on Lakebase). That is the end of training/serving skew by design.
  • Azure Machine Learning: a managed feature store with feature sets, point-in-time retrieval for training data, and materialisation for serving; it is the feature store to use beside Microsoft Fabric.
  • Microsoft Fabric: data science in Fabric tracks experiments and registers models with MLflow, keeps features as Delta tables in a lakehouse, and scores in batch with PREDICT. Fabric has no feature store of its own, so one definition per feature is kept in the lakehouse's gold tables or in Azure Machine Learning's feature store.
  • MLflow (in both Databricks and Fabric) records each training run's parameters, metrics and input datasets, so a model version points back to the training set version it learned from.

Keep the consent flags in the customer domain's own data, catalogued in Purview like any other column, so the lineage from a model reaches them.

Take it to work

Training data sheet

Describe the data a model learns from and is given in production.

The prediction

  • What the model predicts, and when the prediction is made

Features

  • Each feature, its definition and its source columns
  • As of which moment each is computed

Training set version

  • Cut-off, feature definitions' version, fingerprint
  • Rows left out, and why (consent, cut-off)

Serving

  • Where production gets each feature
  • How training and serving share one definition

Lineage

  • From the model back to the source columns and the consent flags

Tools in this chapter

  • Lineage explorer · Trace a number back to its sources, or a change forward to everything it breaks.

Terms taught here: FeatureFeature storePoint-in-time correctnessTraining/serving skew

An unhandled error has occurred. Reload 🗙

Reconnecting…

Your connection to the Cloud Data Architecture Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.