← Clinical AI & Healthcare Evidence, systems and care.

Opening the black box: SHAP and permutation importance

🌿 Growing
#interpretability#shap#feature-importance#explainability#trust
TL;DR

A powerful model can predict a risk score and still be useless to a coach or clinician if it cannot say why. Two model-agnostic tools fix that: permutation importance for what matters overall, and SHAP for why this one case scored the way it did. Both work without retraining.

Method note: these interpretability methods are cited to their primary papers. I studied them inside the DeepLearning.AI “AI for Medicine” specialization; nothing proprietary is reproduced. The diagram is my own.

Context

A model can be accurate and still be unusable. If a tool tells a physio “reinjury risk 72%” and cannot say what drove that number, no serious clinician will act on it, and they are right not to. The value of a risk score in practice is not only its accuracy, it is whether a human can see the reasoning and decide whether to trust it. That is what interpretability buys.

The concept

Two tools cover the two questions people actually ask.

Permutation importance answers “what matters overall”. You take a trained model, shuffle one feature’s column, and measure how much the performance drops. If shuffling a variable barely changes anything, the model was not really using it. It is fast, it works on any model, and it needs no retraining (the idea comes from Breiman’s Random Forests, 2001). One honest detail: if a feature is never used, its importance is exactly zero, not “a little”.

SHAP answers “why this case”. Borrowing from game theory, it treats each feature as a player and splits the credit for a single prediction fairly, averaging each feature’s contribution over all the orders it could have entered (Lundberg and Lee, 2017). The pieces sum exactly to the prediction minus the average, so nothing is invented or lost. A positive value pushed the score up, a negative one pulled it down.

ToolQuestionLevelRetrain?
Permutation importanceWhat matters overall?GlobalNo
SHAP (force plot)Why did this case score this way?One caseNo
SHAP (mean absolute)What matters overall, additively?GlobalNo
base 0.30 score 0.72 load +0.22 poor sleep +0.14 strength −0.10 age +.06 Red pushes the reinjury score up, blue pulls it down. The bars sum to the prediction minus the base value.
A single athlete's risk broken into feature contributions, force-plot style. My own diagram.

Beyond medicine

The same explanations turn a scary number into a coaching conversation:

  • Explaining a readiness or injury-risk score to an athlete. A force plot says, in plain terms, “your number is high mostly because of load and poor sleep, and your strength is actually protecting you”. That is something an athlete can act on, unlike a bare 72%.
  • Honest feature importance for a screening tool. Before you tell a gym that “mobility predicts injury”, run permutation importance. If shuffling mobility does not move the model, it was decoration. This kills a lot of confident but empty claims.
  • Auditing your own bias. When a model leans hard on age or sex, interpretability makes that visible so you can decide whether it is fair or just a shortcut the data handed you.
  • Any tabular decision system. Nutrition adherence, dropout risk, talent identification. If a model drives a decision about a person, that person deserves to see the reasoning, and these tools provide it without touching the model.

The transferable rule: never ship a score you cannot explain. Accuracy earns a model into the room, but interpretability is what lets a human trust it enough to act.

Nota de método: estos métodos de interpretabilidad están citados a sus artículos primarios. Los estudié dentro de la especialización “AI for Medicine” de DeepLearning.AI; no se reproduce nada propietario. El diagrama es propio.

Contexto

Un modelo puede ser exacto y aun así inservible. Si una herramienta le dice a un fisio “riesgo de re-lesión 72%” y no puede decir qué llevó a ese número, ningún clínico serio va a actuar, y hace bien en no hacerlo. El valor de un score de riesgo en la práctica no es solo su exactitud, es si un humano puede ver el razonamiento y decidir si confía. Eso es lo que compra la interpretabilidad.

El concepto

Dos herramientas cubren las dos preguntas que la gente de verdad hace.

Permutation importance responde “qué importa en general”. Tomas un modelo entrenado, barajas la columna de un feature y mides cuánto cae el rendimiento. Si barajar una variable casi no cambia nada, el modelo no la estaba usando de verdad. Es rápida, funciona con cualquier modelo y no necesita reentrenar (la idea viene de los Random Forests de Breiman, 2001). Un detalle honesto: si un feature nunca se usa, su importancia es exactamente cero, no “un poquito”.

SHAP responde “por qué este caso”. Tomando prestado de la teoría de juegos, trata cada feature como un jugador y reparte de forma justa el crédito de una predicción, promediando la contribución de cada feature sobre todos los órdenes en que pudo entrar (Lundberg y Lee, 2017). Las piezas suman exactamente la predicción menos el promedio, así que nada se inventa ni se pierde. Un valor positivo empujó el score arriba, uno negativo lo jaló abajo.

HerramientaPreguntaNivel¿Reentrena?
Permutation importance¿Qué importa en general?GlobalNo
SHAP (force plot)¿Por qué este caso puntuó así?Un casoNo
SHAP (media absoluta)¿Qué importa en general, de forma aditiva?GlobalNo
base 0.30 score 0.72 carga +0.22 mal sueño +0.14 fuerza −0.10 edad +.06 El rojo empuja el score de re-lesión arriba, el azul lo baja. Las barras suman la predicción menos el valor base.
El riesgo de un solo atleta desglosado en contribuciones por feature, estilo force plot. Diagrama propio.

Más allá de la medicina

Las mismas explicaciones convierten un número que asusta en una conversación de coaching:

  • Explicar un score de readiness o de riesgo de lesión a un atleta. Un force plot dice, en términos llanos, “tu número está alto sobre todo por la carga y el mal sueño, y tu fuerza en realidad te está protegiendo”. Eso sí se puede accionar, a diferencia de un 72% pelado.
  • Importancia de variables honesta para una herramienta de screening. Antes de decirle a un gimnasio que “la movilidad predice lesión”, corre permutation importance. Si barajar la movilidad no mueve el modelo, era decoración. Esto mata muchas afirmaciones seguras pero vacías.
  • Auditar tu propio sesgo. Cuando un modelo se apoya fuerte en la edad o el sexo, la interpretabilidad lo hace visible para que decidas si es justo o solo un atajo que los datos te regalaron.
  • Cualquier sistema de decisión tabular. Adherencia a la nutrición, riesgo de abandono, identificación de talento. Si un modelo decide sobre una persona, esa persona merece ver el razonamiento, y estas herramientas lo dan sin tocar el modelo.

La regla transferible: nunca publiques un score que no puedas explicar. La exactitud mete al modelo en la sala, pero la interpretabilidad es lo que deja que un humano confíe lo suficiente para actuar.

Sources