Log inStart free
LESSON 4.60 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

SHAP

Watch SHAP split one house's predicted price among its four features.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 4.60 · SHAP BAYφ₀ 195.9 · f(x) 192.5 · GAP −3.4 K$
01
Stage 1 of 5 · Base value
The base value is the mean model price of 24 training houses, 195.9 k$. SHAP explains why house 65 gets 192.5 k$.
Explain it simply

Each teal dot is one training house, placed at the price the model gives it. The dashed line is their average, 195.9 thousand dollars. That's the model's guess when it knows nothing about a house. House 65 gets 192.5, 3.4 thousand dollars below, and SHAP splits that gap among the four features.

Twenty-four dots on a price axis. The base value line is at 195.9 k$. The line of house 65 is at 192.5 k$.

houses and featuresprices, pushes uppushes downweights
house 65, xsize80 m²distance1 kmage40 yrnumber65f(x) = 192.5 k$real price 179 k$100150200250300350model price (k$)φ₀ = 195.9f(x) = 192.5the base valueφ₀ = mean of 24 model prices = 195.9 k$ · f(x) − φ₀ = −3.4house 65, xsize80 m²distance1 kmage40 yrnumber65f(x) = 192.5 k$real price 179 k$100150200250300350model price (k$)φ₀ = 195.9f(x) = 192.5the base valueφ₀ = mean of 24 model prices = 195.9 k$ · f(x) − φ₀ = −3.4
Toy: 4.58's 24 training houses, 4 features, 30 boosted trees
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
ϕ0=124∑j=124f(bj)\sy{phi0}{out}{\phi_0} = \frac{1}{24}\sum_{j=1}^{24} \sy{fb}{out}{f(b_j)}
ϕ0=4702.0/24=195.9,f(x)=192.5\phi_0 = 4702.0 / 24 = 195.9,\quad f(x) = 192.5

The base value is the mean prediction over the training houses.

Common mix-ups

MYTHA SHAP value is the gain from adding the feature last.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01For house 65, does size push the price up or down?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.