Gnox AI / Blog

,

Explainable Machine Learning: Methods and Examples

Laptop displaying data preparation and analytics concepts for AI applications.

Explainable machine learning helps people understand how a model arrived at a prediction or what it tends to rely on across many predictions. You might trace the rules in a decision tree, see which inputs moved a single prediction, or test whether a model depends on a particular feature to perform well.

Start by deciding who needs the explanation and what they need to do with it. A developer tracing a bug may need feature values and model versions. An operations team may only need to know which input triggered a flag and whether it can verify that input.

Local and global explanations

A local explanation answers a question about one prediction, such as why one shipment was flagged as likely to arrive late. A global explanation describes behavior over a defined dataset, such as which signals help a model distinguish late shipments from on-time ones.

A shallow decision tree or short rule list can provide both kinds of explanation. For a complex model, you can add an explanation method after training. Compare your complex model with a simpler baseline on the same held-out data before deciding which one to use.

Which explanation method should you use?

Permutation importance asks what happens to a chosen score when you shuffle one input across a validation dataset. It is useful for estimating how much the fitted model relies on that input overall. If two fields contain similar information, shuffling either one alone may make little difference.

SHAP allocates the difference between one prediction and a reference prediction among the inputs. Check which records define that reference and whether the output is expressed as a probability, log-odds, or another model score. Those choices affect how to read the calculation.

LIME fits a simpler model around a single example to approximate the original model nearby. Check whether the approximation agrees with the original on realistic examples close to the input. A counterfactual explanation asks what input changes would lead to a different model output, which can be useful when the suggested changes are feasible.

Worked example: explaining a late delivery prediction

Suppose a delivery model assigns a package a 68% chance of arriving late. In a fictional SHAP example on the probability scale, the reference prediction is 30%. A missed depot scan adds 23 percentage points, a route backlog adds 20, and an earlier dispatch subtracts five. Together those contributions give 68%.

An operator can use the explanation to check whether the missing scan is real or whether a feed is delayed. The contribution alone does not establish that the scan caused the predicted delay. The AI-ready data guide covers how to document the authority and freshness of an input like that scan.

How to check whether an explanation holds up

NIST’s four principles ask whether the system supplies an explanation, whether the recipient can understand it, whether it accurately reflects the process, and whether the system recognizes the limits of its knowledge. Apply those principles to the decisions people actually make after reading an explanation.

Test whether the explanation changes sensibly when an input shifts within a valid range. Look for unstable explanations across similar cases and changes after a model update. Measure predictive quality and fairness separately. The AI evals guide covers repeatable tests, and the machine learning app tutorial shows where to present a prediction and its supporting information.

Frequently asked questions

What is the difference between explainability and interpretability?

People often use the terms interchangeably. A common distinction is that an interpretable model is understandable by design, while explainability also includes methods added after training.

Can SHAP tell me what caused an outcome?

Standard SHAP values describe how model inputs contribute to a prediction relative to a chosen reference. That does not show what would happen if you intervened in the real world.

Can a simple decision tree explain an individual prediction?

Yes. Trace the branches for that input to the leaf that produced the prediction. Large trees can still be hard to understand at a global level.

What if two explanation methods disagree?

Check the question each one answers. Shuffling tests how a feature affects performance over a dataset, while a local attribution explains one prediction against a reference. Also review correlated features and model output units.