cd /news/artificial-intelligence/my-model-was-87-accurate-and-almost-… · home › topics › artificial-intelligence › article
[ARTICLE · art-175667] src=pub.towardsai.net ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

My Model Was 87% Accurate and Almost Perfectly Calibrated.

A developer released model-audit, an open-source tool that audits fitted scikit-learn, XGBoost and PyTorch models, and used it to show that a gradient-boosted classifier on the UCI Adult census extract (48,842 people, scored on 12,211 held-out rows) with 87% accuracy and an expected calibration error of 0.007 fails five of eight fairness checks. The model predicts income above $50K for 25.6% of men (n = 8,147) versus 8.4% of women (n = 4,064), a selection ratio of 0.33 against the 0.80 four-fifths convention, and ranks sex=Female as the 6th most important of 91 features by mean absolute SHAP value. The author argues an audit should present every fairness definition with its numbers rather than issue a verdict, since demographic parity fails while equalized odds passes when base rates differ (11.0% of women and 30.4% of men in the 1994 data earn above $50K).

recommendation

Run fairness checks on the full dataset, not a speed sample: a 12,000-row sample shrank the smallest race group to 26 people and moved race equalized odds from 0.135 to 0.647.

more in playbook: Evals and testing for LLM apps
by read4 min views1 publishedNov 24, 2026

Most machine learning portfolios show a model being built. Very few show a model being audited, and auditing is the step that decides whether a model ships.

So I built model-audit. You hand it a fitted scikit-learn, XGBoost or PyTorch model, and it gives you back: Every method except SHAP is written by hand, in code short enough to read. A fairness tool whose definitions you cannot inspect is not an audit tool. It is a second black box.

Then I pointed it at a model.

The live demo at model-audit.streamlit.app*.*

The model is a gradient-boosted classifier trained on the UCI Adult census extract: 48,842 people, predicting whether income is above $50K. I scored it on a held-out quarter, 12,211 rows.

An expected calibration error of 0.007 means that when this model says “70%”, it is right about 70% of the time. By the measures most teams check, this model is finished.

Five of eight checks fail. The model predicts “>$50K” for 25.6% of men (n = 8,147) and 8.4% of women (n = 4,064). That is a selection ratio of 0.33. The “four-fifths” convention from US employment guidance flags anything below 0.80.

The explanations agree. Ranked by mean absolute SHAP value, sex=Female is the 6th most important of 91 features. It sits above capital loss and above every occupation. The model is not working out sex from proxies. It is using the column.

Here is where the story gets more honest, and more useful.

For sex, demographic parity fails but equalized odds passes. Those two checks ask different questions: The model can fail the first and pass the second because the groups differ in the data itself. In this 1994 extract, 11.0% of women and 30.4% of men earn above $50K. A perfectly accurate model would still select men at almost three times the rate.

So how much of the gap does the model create? I compared the model’s selection ratio with the ratio already in the data:

So the model did not invent the gap. But it falls further short for women than for men. For every 100 men who really earned above $50K, it picked about 84 men. For every 100 such women, it picked about 76. In relative terms, women’s share of the picks shrinks. Then there is the error that hurts most. Among women who really did earn above $50K, the model found 59.6%. Among men, it found 66.0%. Qualified women are missed more often.

This is the real point of the project. “Is this model fair?” has no single answer, because different definitions of fairness cannot all hold at once when groups have different base rates. That is a known result, not a flaw in this model. An audit’s job is not to hand down a verdict. It is to put every definition on the table with its numbers, so the people deciding can see which trade-off they are making.

All four of these happened after every test had passed. I found them by running the full audit and reading what it said.

  1. The fix exposed a second problem. With the cap gone, every row got the same advice: “have $15,024 of capital gains.” That is true for the model and useless to a person, because capital gain measures wealth, not a choice. With capital gain and loss treated as non-actionable, the search proposes changes to education, hours, occupation and sector. For rows it cannot honestly flip, it returns nothing: 17 of the first 40 rejected rows got a real counterfactual.

  2. The importance chart was in alphabetical order. The bar chart sorted features alphabetically, so the “top features” chart showed age first and sex=Female last. A ranking chart that is not ranked tells the reader the wrong thing. You only see that by looking at the page.

  3. The demo disagreed with the README. It defaulted to a 12,000-row sample for speed. That shrank the smallest race group to 26 people and moved race equalized odds from 0.135 to 0.647. The interface did warn about it, but only on one tab. The demo now runs on the full dataset by default, and every check shows its smallest group’s n.

There was a fifth, smaller one. Three tests passed on my machine and failed on GitHub, because my environment already had two optional dependencies installed that CI did not. A green local run is a claim about your machine, not about the code.

The next project in this series moves from auditing a classical model to the layer that decides whether an LLM change ships: an eval harness that catches regressions before users do.

I’m Emmanuel Nwanguma, an ML and AI engineer in Lagos. View My Portfolio

My Model Was 87% Accurate and Almost Perfectly Calibrated. was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @model-audit 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/my-model-was-87-accu…] indexed:0 read:4min 2026-11-24 · —