Explaining a Result to Someone Who Isn't Technical
A plain-language explanation of a model's result says what it predicts, how far off it usually is in the reader's own units, the few things it leans on most, what it doesn't know and where it shouldn't be trusted, in words the reader uses, without the jargon of a too-technical draft, the emptiness of a too-vague one, or the false precision of a guess given to the cent.
Journeyman · AI Basics · Python · Updated
After this lesson you can
- Build a plain-language explanation that says what a model predicts, its error in the reader's units, what it leans on most and what it doesn't know
- Spot an explanation that's too technical, too vague or falsely precise, and choose the wording that fits the person reading it
Key takeaways
- A good explanation has five parts. What the model predicts, how far off it usually is in the reader's units, what it leans on most, what it doesn't know, and where not to trust it.
- Give the error as a typical miss in the reader's own units, such as about $11 a month, and say it's an average, so some misses are bigger.
- Name the two or three things the model leans on most, in the reader's words, and say they're what the model uses, not what causes the result.
- Round to what the model can back up. A guess given to the cent claims a precision the model doesn't have.
The owner of a 2,720-square-foot home built in 1962 calls Greenway Home Energy about the estimate in their letter, and the call is put through to you. You've measured the forest, ranked what it leans on and drawn how its guess moves with size. None of that helps until it's said in words the caller uses. Every model you build ends up explained this way, to a customer, a manager or a teammate from another department, and the explanation is often all they'll ever see of it.
The example is Greenway's home_energy.csv and the forest from Permutation Importance, trained on 560 homes and measured on the other 140. Each code block is one notebook cell, run in order: the first one trains the forest again.
The numbers you'll need
Before writing a word, get the numbers from the model, not from memory:
import pandas as pd
from sklearn.compose import make_column_transformer
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import OneHotEncoder
homes = pd.read_csv("home_energy.csv")
features = ["size_sqft", "year_built", "insulation", "heating", "occupants", "has_pool"]
X_train, X_test, y_train, y_test = train_test_split(
homes[features], homes["monthly_bill"], test_size=0.2, random_state=42)
prep = make_column_transformer(
(OneHotEncoder(handle_unknown="ignore"), ["insulation", "heating"]),
remainder="passthrough",
verbose_feature_names_out=False,
)
forest = make_pipeline(prep, RandomForestRegressor(n_estimators=200, random_state=0))
forest.fit(X_train, y_train)
guesses = forest.predict(X_test)
misses = (y_test - guesses).abs()
print("Average miss:", round(misses.mean(), 2))
print("Missed by $11 or less:", (misses <= 11).sum(), "of", len(misses))
print("Missed by more than $25:", (misses > 25).sum(), "of", len(misses))
print("Biggest miss:", round(misses.max(), 2))
Average miss: 11.27
Missed by $11 or less: 82 of 140
Missed by more than $25: 15 of 140
Biggest miss: 35.86
print(X_test.iloc[[1]].to_string(index=False))
print("Estimate:", round(guesses[1], 2))
size_sqft year_built insulation heating occupants has_pool
2720 1962 poor gas 2 0
Estimate: 230.04
The caller's home is that one: 2,720 square feet, poorly insulated, gas heat, two people, no pool. The forest's estimate is $230.04. On homes it never saw it missed by $11.27 on average, by $11 or less on 82 of 140, by more than $25 on 15 of 140, and by $35.86 at worst. Permutation importance ranked size first, insulation second and the number of people third.
What a good explanation holds
Five parts, each in the reader's words:
- What it predicts: next month's energy bill, as an estimate, before the bill exists.
- How far off it usually is, in their units: about $11 a month on average, sometimes more.
- What it leans on most: the home's size, its insulation and how many people live there.
- What it doesn't know: only six facts about each home go in. Thermostat habits, the weather next month, appliances and repairs don't.
- Where not to trust it: homes much bigger than the ones it learned from (only 8 of 560 were over 3,000 square feet), and any reading of it as "what causes a bill".
Three drafts
Too technical:
Our RandomForestRegressor (n_estimators=200) predicts $230.04 for your home. Its test MAE is 11.27, and permutation importance ranks size_sqft at 16.31 and insulation at 10.82.
Every number is true, and the caller understands none of it. Column names, class names and metric names are for the team, not the customer.
Too vague:
Our smart AI analyzed your home and determined your personalized bill.
Nothing here can be checked or acted on: no amount, no error, no reason. It also sounds more certain than the model is.
Right:
We estimate next month's bill at about $230. Our estimates are usually within about $11 of the real bill, sometimes more. Your estimate is mostly driven by your home's size and its insulation, which our records list as poor; the number of people living there counts too. The estimate doesn't know how you set your thermostat or what the weather will be. It shows what tends to go with higher bills in our records, so it can't promise what a change such as new insulation would save.
It's longer than the other two, and every sentence earns its place. Each part from the list is there, in the caller's words.
No false precision
"$230.04" claims the model knows the bill to the cent. It doesn't: on new homes it misses by $11 on average. "About $230, usually within about $11" is the honest version: 82 of the 140 test homes were that close, more than half, and "sometimes more" covers the rest, since $11 is an average, not a limit. The same goes for every number you pass on: "size matters most" is truer to a $16.31 importance with a spread of $1.01 than "size is 16.31 important".
And keep "leans on" apart from "causes". The model learned what went together in 560 homes' records. Telling a caller that new insulation will save them $40 a month is a promise the model can't make, however tempting the coefficient in Reading Coefficients and Trees looks.
Check yourself
2 questions to try on the lesson page.
So what
An explanation is the only part of a model most people ever see, so give them the estimate, the typical miss in their own units, the few things it leans on and what it can't know, rounded to what the model can back up.
Sources
- scikit-learn, Permutation feature importance, User Guide: permutation importance shows how important a feature is for a particular model, not its intrinsic predictive value, and the model's predictive power is checked on held-out data before importances are computed.
- scikit-learn, Common pitfalls in the interpretation of coefficients of linear models, example: linear models measure statistical association, and statements about causality call for caution, since correlation doesn't always imply causation.
- scikit-learn, Metrics and scoring: mean absolute error, User Guide: the mean absolute error averages the absolute differences between the true values and the predicted values, so it is in the same units as the label.