Text & documents
Numbers & maths
Data & formats
Security
Development & DevOps
Artificial Intelligence
Finance
Health & Wellness
Productivity
Games & Entertainment
Multimedia & design
Business
How to use
How to use it

Choose some data (two examples or your own CSV), train a model and pick a row: you will see why the model predicts what it predicts for that row, with two methods at once. Everything happens in your browser: your data does not leave it and a pasted CSV is not saved.

SHAP

It starts from the average prediction and shares out, among the variables, how far this row is from it. Each variable gets what it contributes on average over all the possible orders in which it could «join» (Shapley values, from game theory). Exact sum: average + contributions = prediction. With up to 10 variables it is computed exactly; with more, by sampling.

LIME

It makes up rows similar to this one (changing some variables to values from other rows), sees what the model predicts and fits a line that imitates it near this row. The line's weights are the explanation. It is fast and easy to read, but approximate: its fidelity says how much the line resembles the model, and with another seed the weights change. Press «Again» and watch.

The examples have a catch

Both examples are synthetic: the data comes from a known formula, so you can check whether the explanation gets it right. Both have a column with no influence at all (day of birth, door number): its importance should come out close to zero. And in the credit one, age goes hand in hand with years in the job: watch how it takes part of the credit without deserving it, which is what happens with correlated variables.

Explain a modelSHAP and LIME on your data: why it predicts what it predicts
Explain a modelWhy it predicts what it predicts: SHAP and LIME, side by side, on your data

Synthetic data: it comes from a known formula, so you can check whether the explanation gets it right (see the help).

600 rows · classification: the probability of «1»

Model

It gets 84% right on rows it has not seen (92.4% on the training rows).

Row 1 of 150 (from the test rows)
ingresos 2,218deuda 10,924anos_trabajo 3edad 32dia_nacimiento 7

The model says:61.3%(actual: 1)

SHAP (exact, 1280 predictions)

From the average prediction to this row's, variable by variable:

average50.8%
ingresos = 2,218+28.8 pp
deuda = 10,924−15.1 pp
edad = 32−2.1 pp
anos_trabajo = 3−1.5 pp
dia_nacimiento = 7+0.2 pp
this row61.3%

LIME

A line that imitates the model near this row. Weight of each variable (green pushes up):

ingresos+27.3 pp
deuda−12.2 pp
edad−4.8 pp
anos_trabajo−2.3 pp
dia_nacimiento+1.6 pp

Fidelity (R² of the line near the row): 0.45, with 600 made-up rows.

SHAP and LIME rank the variables almost the same (ρ = 1).

What matters most overall

The average |SHAP| of each variable over 30 test rows.

ingresos23 pp
deuda9 pp
anos_trabajo1.2 pp
dia_nacimiento0.7 pp
edad0.6 pp

In this data, «dia_nacimiento» has no influence at all in the formula that generated it: if its bar comes out almost empty, the explanation got it right.

Permutation importance

How much worse the model gets when each column is SHUFFLED in the chosen rows (which breaks its relationship with what is being predicted). The bar is the deviation over 5 shuffles. It measures what the variable contributes to being RIGHT; the mean |SHAP|, above, measures what moves the prediction.

ingresos28.9 pp
deuda9.1 pp
anos_trabajo1.1 pp
edad0 pp
dia_nacimiento−0.5 pp

If it comes out around 0 (or negative), shuffling it changes nothing: the model does not need it to get it right.

Can you trust its probabilities? Calibration

The test rows are grouped by the probability the model gave them (in steps of 10 %) and we check what fraction were actually positive. If it says 70 % and gets 7 out of 10 right, the point lies on the diagonal. The size of the point is how many rows there are.

0%0%50%50%100%100%17% → 4.3% (47)22.8% → 13.3% (15)34.9% → 42.9% (7)44.9% → 44.4% (9)55.9% → 54.5% (11)62.3% → 66.7% (9)75.8% → 81.8% (22)82.3% → 96.7% (30)

Brier: 0.122 (0 is perfect; always saying 50 % gives 0.25) · calibration error (ECE): 9.4%

BrierECE
Not recalibrated (the 70 % one)0.11513.4%
Platt 0.1089.7%
Isotonic 0.1074.6%

Recalibrating needs rows the model hasn't seen: 30% of the training rows are set aside (135 rows), the same model is trained on the rest and the calibrator is fitted on the ones set aside. The table measures that model on the test rows. Platt fits an S-shaped curve (it suits boosting); isotonic assumes no shape, but with few rows it learns the noise (try a tree of depth 8). If it was already calibrated (regression), recalibrating adds nothing.

Points below the diagonal: it gives more probability than there really is (overestimates). Above: it falls short (underestimates). A single tree only gives a few different probabilities (those of its leaves); try “One tree” and “Regression”.