MZQMohd Zamin Quadri
All work

Insurance claims prediction

A Probability Is Not a Decision

Turning a risk score into a decision.

Role
Author
Classification
Engineering prototype
Inspect repository
The value of acting on a policy and the value of leaving it alone, over its probability of claiming. They cross once, and nowhere near one half.Two straight lines over probability of claiming: the expected value of acting on a policy and the expected value of leaving it alone. The four signed values of the repository's illustrative cost matrix appear as the quantities that set their slopes - five hundred for a claim caught early, minus fifty for an unnecessary investigation, minus a thousand for a claim missed, nothing for a policy correctly left alone. The lines cross exactly once, at 3.23 per cent, which is the only threshold the matrix justifies and is solved from those four numbers rather than searched for. One half, where nearly every classifier defaults, is marked beside it, and the span between the two is drawn and labelled as 15.5 times out. The sequence closes on the three things the pipeline keeps apart - rank, calibrate, cut - and on the statement that no versioned data, trained model or evaluation report is published, so nothing here is a measured result.
  1. Problem

    A good ranking is still not a decision.

  2. How it was solved

    I split it into rank, calibrate and decide, using real costs.

    1. Rank
    2. Calibrate
    3. Decide
  3. Result

    3.23%

    the risk where acting pays off

  4. Built with

    • scikit-learn
    • XGBoost
    • LightGBM
    • SHAP
    See the evidence on GitHub
Two straight lines over probability of claiming: the expected value of acting on a policy and the expected value of leaving it alone. The four signed values of the repository's illustrative cost matrix appear as the quantities that set their slopes - five hundred for a claim caught early, minus fifty for an unnecessary investigation, minus a thousand for a claim missed, nothing for a policy correctly left alone. The lines cross exactly once, at 3.23 per cent, which is the only threshold the matrix justifies and is solved from those four numbers rather than searched for. One half, where nearly every classifier defaults, is marked beside it, and the span between the two is drawn and labelled as 15.5 times out. The sequence closes on the three things the pipeline keeps apart - rank, calibrate, cut - and on the statement that no versioned data, trained model or evaluation report is published, so nothing here is a measured result.

Research pipeline / Classification

A claims model gives every policy a number. Someone still has to decide which numbers are worth acting on - and the cost of being wrong is wildly different in the two directions, so where does the line actually belong?

Where the cost matrix puts the cut3.23%

A probability, calibrated, and then turned into a decision

probabilitiesattributedwhich features carry itSplit firstEncoders and scaling fitted onthe training side only.Classifiers comparedBehind one interface, so thisis not a comparison of…CalibratedPlatt or isotonic,cross-validated, scored by…Threshold searchedAgainst the cost criterion.The two costs are wildly…AttributionWhat the chosen model restson, computed after it is…Worth acting onAbove the line the costs putit, not above one half.Left aloneWhere acting costs more thanbeing wrong about it.
Calibration sits before the threshold search because searching a cut-off over scores that are not probabilities optimises the wrong quantity. The gate has two exits, and they cross once - nowhere near one half.

This diagram in words

  1. Split first gate — Encoders and scaling fitted on the training side only.
    pandas
  2. Classifiers compared process — Behind one interface, so this is not a comparison of harnesses.
    scikit-learn · XGBoost · LightGBM
  3. Calibrated process — Platt or isotonic, cross-validated, scored by Brier.
  4. Threshold searched gate — Against the cost criterion. The two costs are wildly unequal.
  5. Attribution artifact — What the chosen model rests on, computed after it is chosen.
    SHAP
  6. Worth acting on sink — Above the line the costs put it, not above one half.
  7. Left alone sink — Where acting costs more than being wrong about it.

01 / 7Two actions, one probabilityThe value of acting on a policy, and the value of leaving it alone, over the chance it claims.

Actions
Act on the policy, or leave it alone
What decides between them
The chance it claims, and what each outcome costs
Models compared upstream
logistic regression, random forest, XGBoost, LightGBM
Two straight lines over probability of claiming: the expected value of acting on a policy and the expected value of leaving it alone. The four signed values of the repository's illustrative cost matrix appear as the quantities that set their slopes - five hundred for a claim caught early, minus fifty for an unnecessary investigation, minus a thousand for a claim missed, nothing for a policy correctly left alone. The lines cross exactly once, at 3.23 per cent, which is the only threshold the matrix justifies and is solved from those four numbers rather than searched for. One half, where nearly every classifier defaults, is marked beside it, and the span between the two is drawn and labelled as 15.5 times out. The sequence closes on the three things the pipeline keeps apart - rank, calibrate, cut - and on the statement that no versioned data, trained model or evaluation report is published, so nothing here is a measured result.
Read the full background

Problem

Why this work exists

A classifier that ranks well can still be badly wrong about magnitude, and a probability that is right is still not an action. Most of the distance between a model and a decision lives in those two gaps, and collapsing them into one accuracy number hides both - along with the fact that in claims the two kinds of error cost wildly different amounts.

Contribution

What I can claim

Built the pipeline as three separable stages rather than one: a train/test split with encoders and scaling fit on training data only, classifiers compared under one interface, cross-validated calibration scored by Brier, and a threshold search that can optimise for statistical or cost-weighted criteria. The cost matrix is a parameter of that search, not a constant buried in it.

Method

Three problems that get reported as one

A claims model is usually judged by a single number, which quietly assumes that ranking policies, stating honest probabilities and deciding what to do about them are the same achievement.

  1. Rank

    The first question is only whether the model orders policies by risk at all.

  2. Calibrate

    The second is whether the numbers mean what they say - whether policies given a one in five chance claim about one time in five.

  3. Weigh

    The two errors are not comparable.

  4. Cut

    Given calibrated probabilities and those costs, the break-even follows as arithmetic: act when acting is worth more than not acting.

  5. Attribute

    Last, the decision has to be explainable to someone who did not build it, which is why attribution is part of the pipeline rather than a postscript to it.

  6. What this does not show

    The cost matrix is the repository's own example and is not a validated business policy. Nothing here is a result: no data, split, trained model, calibration output or evaluation report is versioned, so there is no accuracy, no AUC and no business value to report - and the code must not be used to make automated decisions about people or policies.

How it was built

System

Workflow and decisions

Five modules, one per stage: the data pipeline, the classifier comparison across logistic regression, random forest, XGBoost, LightGBM, the calibration fit, the threshold search, and SHAP attribution. Generated artefacts stay out of version control, which is why the repository can be read without being mistaken for a result.

  1. 1Split, then fit encoders and scaling on the training side only
  2. 2Compare the classifiers under one interface
  3. 3Calibrate with Platt scaling or isotonic regression, cross-validated, scored by Brier score
  4. 4Search the decision threshold against the chosen criterion
  5. 5Attribute the resulting model with SHAP
  • Python
  • scikit-learn
  • XGBoost
  • LightGBM
  • SHAP
  • pandas

Evidence

What is actually versioned

Where the cost matrix puts the cut3.23%

The repository's example matrix values a claim caught early at +500, an unnecessary investigation at -50, and a missed claim at -1000. Setting the value of acting equal to the value of not acting solves to 3.23% with no dataset involved - 15.5 times below the 0.5 a classifier defaults to. That is arithmetic from four published numbers, and the matrix they come from is illustrative rather than a validated policy.

What is publishedno model result

The repository versions no data, no train/test split, no trained model, no calibration output and no evaluation report, and states that it therefore makes no verified accuracy, AUC, calibration-improvement or business-value claim. This page makes none either.

What is separated3 stages

rank - does the model order policies by risk at all; calibrate - does a stated 20% mean twenty in a hundred; cut - where the probability becomes an action. The cut can be chosen 4 ways: best F1, Youden's J, most expected value, precision at 90% recall.

How the work is checked

Quality controls

How the work is checked

  • Encoders and scaling are fit on the training split only, so the test side is not quietly informed by the data it is meant to judge
  • Calibration is cross-validated and scored by Brier rather than asserted, because a calibration step that is not measured is a hope
  • The cost matrix is an argument to the threshold search rather than a constant inside it, which is what makes it reviewable
  • The README states the matrix is illustrative and must not be used without domain, legal, fairness and risk review, rather than leaving a reader to assume it was validated

Limitations

Where the evidence stops

  • No data, no split, no trained model, no calibration output and no evaluation report are versioned. There is no performance claim here because there is nothing to substantiate one
  • The cost matrix is an example. The threshold derived from it is correct arithmetic about those four numbers and says nothing about what a real insurer's numbers would be
  • Calibration method and threshold should be chosen on a validation set kept separate from the final test set; the supplied scripts are exploratory and do not implement that governance
  • It must not be used to make automated decisions about people or policies, which is the repository's own instruction and the reason this page stops at the arithmetic
What this changed in my practice

What this changed in my practice

The threshold is where the modelling stops and the policy starts, and it is the step most likely to be left at a default nobody chose. Working the cost matrix through to a break-even was the moment the project became about decisions rather than about classifiers: the honest answer was fifteen times away from the habit, and it came from four numbers rather than from any amount of model tuning.

Next evidence milestone: Give the threshold a validation set of its own. Choosing the calibration method and the cut on the same data that reports the final number is the flaw the README already names, and fixing it is a split rather than a model - which makes it the cheapest honest improvement available.