A data model for machine learning is not a different database from the one that runs the business. It is the same tables, designed so that the facts a model needs are stored as columns and the joins between them are keys. This article describes the minimum shape, in the vocabulary an actuary or data scientist will recognise.
Five tables, four keys
- products
- One row per product, with its field definitions (name, type, options), its rate tables (base rate and factors keyed on fields) and its underwriting rules (conditions and outcomes). This is the tariff as data.
- quotes
- One row per risk presented, with product_id, the answers per field, sum insured, cover, duration, channel, the premium, the status and the decline reason if any. The features live here.
- policies
- One row per bound risk, with quote_id, inception, expiry, premium and status; endorsements and cancellations as dated changes. Exposure is computed from here.
- claims
- One row per claim, with policy_id, date of loss, cause, reserve, paid, settled and status. The target lives here.
- activities
- Every change with entity, actor, action and time. Reproducibility and the record of human overrides.
The keys are quote → product, policy → quote, claim → policy. With those three joins and the activity log, every question a modeller asks is a query.
The training frame
From those tables, one query produces the frame a frequency-severity model consumes: one row per policy (or per policy-period after endorsements), the answers as feature columns, exposure in the unit claims scale with, the number of claims and the total loss as targets, and the as-of date so time can be respected in validation.
- features…
- dog_age, breed_size, sum_insured, package, channel, broker_org, … (from quotes.answers and quote columns)
- exposure_units
- earned policy-years, trip-weeks or insured-person-years (from policies and endorsements)
- claim_count
- number of claims on the policy (from claims)
- total_loss
- paid plus reserve, or settled where closed (from claims)
- premium
- charged premium, for loss-ratio and for comparing the model with the current tariff
- as_of
- inception date, for temporal validation
Design rules that make this work
- Field names are the contract. The same fact has the same name in the field definition, the answer, the rate table condition and the rule condition.
- Answers are typed. A number is a number, a date a date, an option one of a fixed list. Casting free text at query time is where projects lose weeks.
- Status transitions are fixed. A claim cannot be 'settled' twice or 'paid' before it is 'open'; the model relies on statuses meaning one thing.
- Money is in one currency per tenant, stored as numbers. Display conversion is never written back.
- Nothing that a model needs lives only in a document. The PDF is generated from the data, never the other way round.
What stays outside the model
Protected characteristics should not be features, and in many regimes gender cannot be used for pricing at all. A clean data model makes this enforceable: if a fact is not a field, it cannot be a feature. It also makes proxy checks possible, because the features are explicit.