Latest / The Practical AI Digest / Explainable AI: Opening the Black Box
Transcript
- 0:00You know, I was looking through the stack of papers and blog
- 0:03posts you sent over for this dive, and it it hit me that
- 0:08we've reached a really strange inflection point in AI.
- 0:11Oh yeah. Yeah.
- 0:12I mean, we've spent the last 10, maybe 15 years completely
- 0:15obsessed with one thing, accuracy.
- 0:18Right, just get the loss function down.
- 0:20Exactly. It's been this race to the
- 0:22bottom for loss. Get the accuracy up, get the AUC
- 0:25up, and you know who cares what happens inside the layers?
- 0:28Right. It was kind of the if it works,
- 0:30don't touch it phase of engineering.
- 0:31Totally. As long as the predictions were
- 0:33good on the test set, nobody asked too many questions.
- 0:36But now, based on everything we're seeing in the industry,
- 0:39the bill is coming due. We have these these massive
- 0:43models, gradient boosted trees, deep neural networks with
- 0:46millions of parameters. And they are making decisions
- 0:48that actually matter. They really matter.
- 0:51We aren't just predicting ad clicks anymore.
- 0:52We're talking about loan approvals, medical diagnosis,
- 0:56autonomous driving. And that is where the black box
- 0:59problem goes from being, you know, an academic curiosity to a
- 1:03massive liability because eventually a stakeholder or a
- 1:06regulator or a doctor is going to look at a prediction and ask
- 1:09why. Why?
- 1:10Why did the model deny this loan?
- 1:11Why did it flag this patient for surgery?
- 1:14And usually the engineer just stares at the floor or they show
- 1:17a confusion matrix which doesn't answer the question at all.
- 1:20Not even close. I don't know.
- 1:22It isn't an acceptable answer when you're dealing with
- 1:24someone's life savings or you know their health.
- 1:28Precisely. Transparency isn't just a nice
- 1:31to have feature anymore, it's a necessity.
- 1:33We need to move from. I know that it works to.
- 1:36I know how it works. And that is the mission for
- 1:38today. We're going to demystify a tool
- 1:41that has, I think you could argue, become the industry
- 1:44standard for cracking open that black box.
- 1:46We're talking about SH. A shapely additive explanations.
- 1:49It is a mouthful, but the concept behind it is just
- 1:52fascinating. What I love about this topic is
- 1:54that it connects modern cutting edge machine learning back to
- 1:58what Nobel Prize winning game theory from the 1950s.
- 2:01It really is the bridge between the rigorous math of fairness
- 2:05and the the messy reality of data engineering.
- 2:10So here is the plan. We're going to break this down
- 2:12into a few distinct parts. We're going to start with the
- 2:15intuition, the robo runners analogy, which I think is the
- 2:18best way to visualize the math. It's a great one.
- 2:20Math. Then we'll get into the
- 2:20mechanics of how you actually calculate this, specifically
- 2:23tackling that marginalization problem.
- 2:26We'll look at the visualization toolkit.
- 2:27And finally, we have to talk about the algorithms, tree shape
- 2:31versus kernel app, and of course the pitfalls.
- 2:34And the pitfalls are significant.
- 2:35It's not a magic wand. No, it's definitely not.
- 2:39But let's start with the origins story.
- 2:40So SHAP was introduced in a paper by Scott Lundberg and Sue
- 2:44and Lee around 2017, but the math they used wasn't new at
- 2:49all. Not at all, no.
- 2:50They basically went dumpster diving in 1950s economics.
- 2:53They realize that the problem of debugging a complex machine
- 2:56learning model is well, it's mathematically identical to a
- 2:59problem in cooperative game theory that Lloyd Shapely solved
- 3:03back in 1953. Lloyd Shapely, who later won the
- 3:07Nobel Prize for this very work. Correct.
- 3:09Shapely was interested in a very specific scenario.
- 3:13Imagine you have a team of people working together to
- 3:15achieve a goal. They cooperate and together they
- 3:18generate some value. A payout, a prize, a win.
- 3:21The core question Shapley tried to answer was how do you fairly
- 3:26distribute that payout among the team members when everyone
- 3:29contributed differently and. Fairly, here's a mathematical
- 3:32term, right? Not just a feeling.
- 3:34Exactly. It has to satisfy specific
- 3:37axioms of fairness. It's rigorous.
- 3:39So to wrap our heads around this, let's use the mental model
- 3:43from the Visoira lecture, the Robo Runners.
- 3:45This is a classic setup, so imagine a robotics team called
- 3:49the Robo Runners. There are four members on this
- 3:52team. OK, they enter competition to
- 3:54build a robot. They work together and they win
- 3:56first prize. They take home $10,000.
- 3:59Simple enough. Four people, 10 grand in the
- 4:02bank. Now comes the problem payday.
- 4:04How do you split the $10,000? I mean if I'm the manager and I
- 4:07just want to go home, I divide by 4.
- 4:09Everyone gets 2500 bucks. The naive approach, but is it
- 4:13fair? Probably not.
- 4:15Let's say one person was the lead engineer who built the
- 4:17navigation system from scratch, and another person was.
- 4:21And let's say the person who brought the snacks.
- 4:23Right. If you give the snack guy $2500,
- 4:26the lead engineer is going to riot, and rightly so.
- 4:30The equal split ignores the reality that contributions are
- 4:33unequal, so that's out. OK, so we need a metric.
- 4:37If I'm trying to be analytical about this, my next instinct is
- 4:39to try a a subtraction method. OK, I'd look at the team and I
- 4:44ask how much value did Bob, let's call the hardware guy Bob,
- 4:49add to the group? And how would you calculate
- 4:51that? I'd simulate the competition
- 4:53without Bob. I'd say OK, the full team wins
- 4:5610,000. If Bob stays home, the remaining
- 4:58three people aren't as good. Maybe they only win second place
- 5:02which is $6000. So the full team gets 10,000,
- 5:04the team without Bob gets 6000. So the logic is 10,000 -, 6000
- 5:09is 4000. Therefore Bob is worth exactly
- 5:12$4000. That's his marginal
- 5:14contribution. It feels intuitive, doesn't it?
- 5:16You're just measuring the drop off.
- 5:18But there's a massive flaw in that logic.
- 5:21I suspect it has to do with the other team members.
- 5:23It's all about interactions. That subtraction method assumes
- 5:26Bob's value is static, that he is worth $4000 regardless of who
- 5:31else is in the room. But think about it.
- 5:33Bob is the hardware expert. He builds the physical robot,
- 5:37right? Now imagine another team member,
- 5:39Alice. She's the algorithm expert.
- 5:41She writes the code. OK, if Alice is also missing,
- 5:45what is Bob's value? Well, if there's no code, the
- 5:48robot is just a paperweight. Doesn't move, so Bob's hardware
- 5:51is. Useless exactly.
- 5:53If Alice isn't there, Bob's marginal contribution might be
- 5:570. But if Alice is there, Bob's
- 5:59contribution is huge because her code has something to control.
- 6:02I see. So the team minus Bob
- 6:04calculation fails because it ignores the context.
- 6:08It only looks at one specific scenario, the full team versus
- 6:11the full team without Bob. It doesn't account for the fact
- 6:14that Bob needs Alice to be valuable.
- 6:16Precisely. And this is the genius of the
- 6:18Shapley solution. To find the true fair
- 6:20contribution of the hardware expert, you cannot just look at
- 6:23the full team. You have to look at every
- 6:24possible subset of the team. Every possible subset.
- 6:28Wow, walk me through that. You have to calculate Bob's
- 6:30impact in every possible reality.
- 6:33You measure his contribution when he works entirely alone.
- 6:35Maybe he wins nothing. Then you measure his
- 6:38contribution when he joins a team of just the snack guy, then
- 6:41when he joins just Alice, then when he joins Alice and the
- 6:44snack guy. Whoa, so you were running a
- 6:46simulation for every single permutation of the group?
- 6:49Yes, you calculate the difference his presence makes in
- 6:52every single combination. And then, and this is the key,
- 6:56you take the weighted average of all those marginal
- 6:58contributions. That average is the Shapley
- 7:01value. And that number is
- 7:03mathematically proven to be the only fairway to distribute the
- 7:06payout. Yes, Lloyd Shapley proved that
- 7:08if you want to satisfy the axioms of efficiency, symmetry
- 7:11and linearity, this is the unique solution.
- 7:14There is no other way to do it. OK.
- 7:15So that's the intuition. We have the robo runners and we
- 7:18have a way to fairly split the $10,000.
- 7:22Now we have to make the jump to machine learning because our
- 7:25listeners aren't managing robotics teams, they're building
- 7:28XG boost models. How does this map?
- 7:30It is a direct mapping. In this analogy, the players on
- 7:34the team are the features in your data set.
- 7:37Features meaning the columns age, BMI, income, zip code, that
- 7:42stuff. Correct.
- 7:43And the payout, the $10,000 prize is the models prediction.
- 7:48But wait, let's be precise here. Is the payout the raw prediction
- 7:52itself like the 80% probability? That's a great catch.
- 7:56No. Technically the payout we are
- 7:59distributing is the difference between the prediction for a
- 8:02specific instance and the average prediction of the data
- 8:06set. OK, let's unpack that.
- 8:07Suppose we are predicting the probability of diabetes.
- 8:10The average person in our data set has, let's say a 10% risk.
- 8:14That's our baseline, right? That's.
- 8:15What the model would predict if it knew nothing about a person?
- 8:18We feed my data into the model and the model spits out an 80%
- 8:22risk. So I'm at 80%.
- 8:23The baseline is 10%, the payout. The thing we need to explain is
- 8:27that 70% gap. Exactly.
- 8:29The question is how do we get from 10% to 80%?
- 8:33We have to distribute that 70 percentage points of credit or
- 8:37blame. Among your features, how much
- 8:40did your age contribute? How much did your BMI
- 8:42contribute? And just like the robot team,
- 8:45these features interact. My high BMI might not be a huge
- 8:48risk factor on its own, but combined with my age it might
- 8:52just explode the risk. Recisely high blood pressure
- 8:54routers more if you are older than if you are younger.
- 8:58The model, assuming it's a good model, captures these complex
- 9:01non linear interactions and SHA untangles them by running those
- 9:05subset calculations. It simulates the model with just
- 9:09age, then agent BMI, then agent income to find the true marginal
- 9:13contribution of each factor. That is such a cool way to frame
- 9:17it, but I want to highlight something you mentioned in the
- 9:19notes, the difference between local and global explanations
- 9:22because I see people get this mixed up all the time.
- 9:24They do. It's a critical distinction.
- 9:26Global explanations tell you how the model works in general.
- 9:29For example, a feature importance plot in a random
- 9:31forest might tell you overall income is the most important
- 9:34predictor. Which is like saying smoking is
- 9:37generally bad for your health. Right, it's a statistical
- 9:40statement about the population, but that doesn't help you
- 9:42understand a specific prediction.
- 9:44If you have a specific applicant who is denied a loan, telling
- 9:47them income is generally important doesn't explain their
- 9:51denial. Maybe their income was fine.
- 9:53Right. Maybe for this specific person
- 9:55it was their debt to income ratio that sank them.
- 9:58Exactly. SHAP provides local
- 10:01explanations. It explains this specific
- 10:03instance. Why was the 65 year old
- 10:06classified as diabetic? It allows you to debug the model
- 10:10at the row level. Which is incredibly powerful.
- 10:12But yeah, and here is where the rubber meets the road for me.
- 10:16I have a practical engineering question.
- 10:18In the robo runners example, we said we calculate these subsets
- 10:21by removing a person. I can physically tell Bob, hey,
- 10:25go wait in the hall, we're going to build the robot without you.
- 10:28But in a machine learning model, specifically something like a
- 10:30neural net, I have a matrix of data.
- 10:33I have a fixed input layer. It expects 50 numbers.
- 10:36I can't just delete the age column for one row and expect
- 10:39the model to run. The math will fail.
- 10:41The model will crash. So how do we remove a feature to
- 10:45calculate these subsets? You've hit on the central
- 10:48engineering challenge of SHA and you are right.
- 10:50Most models cannot handle missing data natively, so we
- 10:55have to fake it. We use a technique called
- 10:56marginalization. Marginalization.
- 10:58OK, unpack that. How do we mask a feature without
- 11:02breaking the model? We simulate the feature being
- 11:05missing by replacing its real value with a random value from a
- 11:09background data set, usually the training data.
- 11:11A random value, so we're just injecting noise.
- 11:13In a way, yeah. Think of it as Monte Carlo
- 11:16integration. Let's say we want to measure the
- 11:18importance of your age. We want to simulate a team
- 11:21without your age, so we keep your BMI, your blood pressure,
- 11:25and your income exactly as they are.
- 11:26Those are the fixed team members.
- 11:28But for your age, we swap it out.
- 11:30Swap it with what? We might grab the age of a
- 11:32random person from the training data.
- 11:34Let's say we pull a record and it's a 25 year old.
- 11:36We plug that in and run the prediction.
- 11:38Then we pull another record, a 50 year old, run the prediction,
- 11:40then an 80 year old, and so on. So we are creating these
- 11:44synthetic Frankenstein data points where everything is me
- 11:49except my age is just morphing into different people from the
- 11:52database. Exactly.
- 11:54We are integrating over the distribution of that feature.
- 11:57We are asking the model. If we didn't know your age and
- 12:00just assumed you had a typical age from the data set, what
- 12:03would the prediction be? I see.
- 12:05So if I swap my age with a bunch of random people's ages and the
- 12:08prediction stays basically the same.
- 12:10Then your specific age didn't matter, the model wasn't relying
- 12:14on it. It's like a light switch that
- 12:15isn't connected to the bulb. You can flip it up and down
- 12:18255080 and the light which is the prediction.
- 12:21It doesn't change. But if the prediction swings
- 12:23wildly, if putting in 25 makes me healthy and putting in 80
- 12:28makes me diabetic. Then your specific age was
- 12:30providing a lot of information. It has a high marginal
- 12:32contribution, a high SHP value. That makes sense.
- 12:35So mathematically, SHAP is really just comparing the
- 12:39prediction with your actual feature value against the
- 12:41expected prediction with random feature values averaged over
- 12:45many many combinations. That is the essence of it and
- 12:49the output. The SHAP value has a direction.
- 12:52A positive SHA value means this feature pushed the prediction
- 12:56higher towards the positive class, like yes, diabetic and.
- 12:59A negative value means it pushed it lower.
- 13:01Exactly. Which brings us to
- 13:03visualization. Because a list of numbers is
- 13:06great. But engineers, we need to see
- 13:08this stuff. The toolkit for SAP is actually
- 13:10really beautiful. It is.
- 13:11It's one of the reasons it became so popular.
- 13:13Let's talk about the force plot first.
- 13:15This is standard for tabular data.
- 13:17I love the force plot, it looks like a tug of war.
- 13:20It is a tug of war. Imagine a horizontal bar.
- 13:23In the middle you have the base value.
- 13:25That's the average prediction of the data set, let's say 10%.
- 13:28OK, a starting point. Then you have red bars pushing
- 13:31the prediction to the right, increasing the risk, and blue
- 13:34bars pushing it to the left, decreasing the risk.
- 13:37So for our diabetes example, I might see a big fat red bar
- 13:41labeled BMI 30 pushing the score way up, and maybe a small blue
- 13:46bar labeled exercise daily pushing it back down a little
- 13:49bit. Correct.
- 13:50And where those opposing forces meet that equilibrium point is
- 13:54the final prediction. It lets you tell a story.
- 13:56You can say to a customer, look, your credit score is high
- 13:59because your payment history is perfect.
- 14:01That's this big red bar, despite the fact that your account is
- 14:04new. This little blue bar.
- 14:05That's the local view, but what if I want to see the global
- 14:08patterns? The summary plot is usually what
- 14:10people put in their slide decks. The summary plot or bees worm
- 14:13plot is fantastic for that. Imagine taking those force plots
- 14:16for every single person in your database and stacking them on
- 14:19top of each other. So.
- 14:20You get a cloud of points. A swarm?
- 14:22Yeah. On the Y axis you have your
- 14:24features, Age, income, BMI. On the X axis is the SHAP value,
- 14:31the impact on the model. OK, so if you look at the row
- 14:33for age, you might see a big cluster of red dots which
- 14:36represent high values of age way over on the right side of the
- 14:39plot. Which tells you that being older
- 14:41generally increases the prediction.
- 14:42Right, but you might also see that for income, the dots are
- 14:45spread out all over the place, meaning it's a messy, complex
- 14:48feature with no simple relationship.
- 14:51The visualization that really blew my mind in the lecture
- 14:54though was for images. We aren't just stuck with
- 14:57sreadsheets, HA works on pixels. This is where it gets really
- 15:01intuitive for image classification.
- 15:04HA roduces A Ixel heat map. O If I have a picture of an
- 15:07American egret, a white bird, and the model correctly
- 15:12identifies it, SHAP can tell me which pixels convince the model.
- 15:16Exactly. It'll turn the pixels on the
- 15:18beak and the wings red. It's saying.
- 15:20I think this is an egret because of this long pointy thing in
- 15:23these feathers in the. Background The sky, the water.
- 15:26The water should be neutral. Ideally, yes, the pixels for the
- 15:29sky should be Gray. The model should be saying I'm
- 15:32ignoring the sky, it's not relevant.
- 15:34But this brings us to the famous cautionary tale, the Husky
- 15:37versus wolf story. This is a classic in the
- 15:40interpretability field. It's legendary.
- 15:42So researchers trained a model to distinguish between wolves
- 15:45and Huskies. It had incredible accuracy.
- 15:48I mean, everyone was celebrating.
- 15:49High fives all around. We solved it.
- 15:51Then they ran an explanation tool.
- 15:53It was actually Lyme in the original paper, but S Chip does
- 15:55the same thing to see why it was classifying images as wolves.
- 15:58And what did they find? Was it looking at the ears?
- 16:01The snout? The shape of the head.
- 16:03It was looking at the snow. The snow.
- 16:05The snow. It turned out that in the
- 16:07training data, almost every picture of a wolf was taken in
- 16:11the wild in the winter. So there was snow in the
- 16:13background. Oh no.
- 16:14And almost every picture of a Husky was a pet in a backyard on
- 16:18grass. So the model didn't learn wolf,
- 16:22it learned snow detector. Exactly.
- 16:24If there is snow, it's a wolf. If there is grass, it's a Husky.
- 16:27It took the lazy way out. That is terrifying.
- 16:30I mean, it's funny with dogs, but if that's a medical imaging
- 16:33model detecting tumors. It's a disaster, and there have
- 16:36been real cases where models learn to detect tumors based on
- 16:39the ruler placed next to the tumor in the training images or
- 16:43the hospital tag in the corner of the X-ray.
- 16:45Because the sickest patients always had the ruler or the tag
- 16:48next to them. Right.
- 16:49Without a tool like SHAP to visualize those heat maps, you
- 16:53would never know. You would deploy a model that
- 16:55has 99% accuracy on your test set, but fails completely in the
- 16:59real world because there's no ruler.
- 17:02SHAP is a debugging tool. It tells you if your models
- 17:05right for the wrong reasons. That's the perfect way to put
- 17:09it. OK, so we have the theory, the
- 17:10mechanics and the visuals. Now we have to talk about the
- 17:13elephant in the room. Computational cost.
- 17:15Oh yes, the big one. We said earlier that to get the
- 17:19real true shapely value you have to check every possible subset.
- 17:23Every single permutation I remember enough.
- 17:25Combinatorics to know that that grows exponentially.
- 17:29If you have N features, the number of subsets is 2 to the
- 17:32power of N, correct? So if I have a data set with
- 17:35just 50 features, which is pretty small for modern AI,
- 17:39that's 2 to the 50th power calculations per row.
- 17:43Which is roughly A quadrillion. You are not running that on your
- 17:46laptop. You aren't running that on a
- 17:48supercomputer. It's just not feasible.
- 17:50So is this all just a nice theory that we can't actually
- 17:52use? No, and this is the main
- 17:54contribution of Lundberg and Lee.
- 17:56They developed approximation algorithms that get us very very
- 17:59close to the true value without calculating every single subset.
- 18:04OK, So what are the main solvers we need to know about?
- 18:07The first one, and the most general is kernel shape.
- 18:11This is a model agnostic method. It works on anything neural
- 18:14networks, SVM's, logistic regression, any black box you
- 18:18can throw at it. And how does it work
- 18:20intuitively? It uses a specific type of
- 18:23weighted linear regression, essentially fitting a simple
- 18:26explainable model locally around the prediction you're trying to
- 18:29explain to approximate the Shapley values.
- 18:32It's actually based on an earlier method, client Lyme.
- 18:34Is it fast? No.
- 18:36It's slow. Very slow.
- 18:38It requires a lot of sampling, which means running the model
- 18:40many, many times. It's really the fall back option
- 18:43if you have a weird custom model that nothing else supports.
- 18:45OK, but most of our listeners are probably using tree based
- 18:48models. Yeah, XG, Boost, light, GBM,
- 18:51random forest. That's the bread and butter of
- 18:53tabular data. For them there is tree HAPE and
- 18:55this is a total game changer. Why is tree shape different?
- 18:59Why is it so much better? Because tree shape leverages is
- 19:02the actual structure of the decision trees, it doesn't need
- 19:05to treat the model as a black box.
- 19:07It looks inside, I see a tree is just a series of splits, right?
- 19:10Is age greater than 50 yes or no?
- 19:13So tree SHAP can calculate the exact Shapley values by
- 19:17efficiently traversing the paths of the tree.
- 19:19So it doesn't need to do all that random sampling we talked
- 19:21about. Exactly.
- 19:22No sampling needed. It computes the probability of
- 19:26reaching different leaves based on the distribution of data in
- 19:29the tree nodes. It turns an exponential problem
- 19:322 to the north into a polynomial problem.
- 19:35In English. It's fast.
- 19:37Extremely fast. If you are using XG boost or
- 19:41light GBM. Tree shape is effectively free.
- 19:43You should always use it. It makes explain ability
- 19:45feasible for massive data sets. And for the deep learning crowd,
- 19:49the neural net folks. There's deep HP.
- 19:51It hooks into the neural network layers in a way that's similar
- 19:54to how back propagation works, to propagate the important
- 19:57scores from the output all the way back to the inputs.
- 20:00It's an approximation, but it's designed to handle the
- 20:02complexity of deep networks efficiently.
- 20:05OK, so we have the tools, but we promised the listeners we'd talk
- 20:08about the gotchas. Section 5 of the deep dive
- 20:11because nothing is perfect. The biggest pitfall, and this is
- 20:14something advanced practitioners argue about constantly, is the
- 20:19independence assumption. We test on this with
- 20:22marginalization. When we swap in a random value
- 20:25for a feature, we are assuming we can do that without, you
- 20:29know, breaking reality. Right, the core SHAP algorithm
- 20:33assumes features are independent, but in the real
- 20:35world features are often highly correlated.
- 20:38Give me the five year old millionaire example.
- 20:40This is my favorite illustration of the problem.
- 20:42It's the perfect example of creating out of distribution
- 20:45data. So imagine you have a model
- 20:48predicting credit risk. You have two features, age and
- 20:51income. And in the real world, these are
- 20:53correlated. Generally you make more money as
- 20:55you get older. Up to a point, right?
- 20:58Now suppose we are calculating the SHAP value for age.
- 21:02We take a data point, Let's say ACEO who is 55 and earns 500,000
- 21:06a year. OK, to test the importance of
- 21:08age, SHAP swaps out the CE OS real age for a random age from
- 21:13the data set. And let's say the random age it
- 21:15picks is. 5 exactly. So now we are asking the model
- 21:19to make a prediction for a 5 year old earning $500,000.
- 21:24Which is a data point that doesn't exist.
- 21:26It's impossible. It's nonsensical.
- 21:28It is completely off the manifold of real data.
- 21:32The model has never seen anything like this during
- 21:34training. It has no idea what to do with
- 21:37it. So the model effectively
- 21:38hallucinates it just makes something up it.
- 21:40Extrapolates. It might spit out a really weird
- 21:42prediction just because it's confused and that garbage
- 21:45prediction gets fed into the SAP calculation.
- 21:48So you get ASAP value that looks precise.
- 21:51You know age contributed positive 0.2.
- 21:54Yeah, but it's based on a scenario that is total nonsense.
- 21:57Exactly. Garbage in, garbage out.
- 21:59If features are heavily correlated, the credit
- 22:02assignment can get very messy. The math tries to be fair, but
- 22:06if the data points used to calculate the fairness are
- 22:08themselves nonsensical, the result is compromised.
- 22:11Is there a fix for this? There are variations of SAP that
- 22:15try to account for correlation, but they are computationally
- 22:18much much heavier. The practical advice is be aware
- 22:22of it. If 2 features are 99%
- 22:25correlated, like years of education and education level,
- 22:29SHA might split the credit between them arbitrarily, or
- 22:32they might even cancel each other out with one being
- 22:34positive and one negative. So don't just blindly trust the
- 22:37plot. You have to understand the data
- 22:39structure underneath. If you see something weird,
- 22:42check your correlations. Always SHAP is a tool for the
- 22:45engineer to understand the model.
- 22:47It doesn't replace the engineer. We're coming up on time, so I
- 22:50want to zoom out. We've gone from 1950s game
- 22:53theory to robo runners to snow detecting wolves to the math of
- 22:58masking. It's a huge.
- 22:59Landscape. If a listener takes away just
- 23:00one thing, one core concept from all this, what should it be?
- 23:04That SHAP is the bridge between accuracy and interpretability.
- 23:08For a long time we thought we had to choose, you know, Do you
- 23:11want a dumb model you can understand, like a linear
- 23:14regression, or a smart model that's a black box?
- 23:18SHA proves we can have both. We can use the complex high
- 23:21accuracy models and still debug. Them, and I'd emphasize the
- 23:24debug part. Yes, absolutely.
- 23:27Don't just use this to make pretty charts for the quarterly
- 23:29business review. Use it to check if your model is
- 23:32learning the right patterns. Use it to catch the snow before
- 23:36you deploy the wolf. That is the most valuable
- 23:38application, period. But I want to leave us with a
- 23:41provocative thought, something to chew on.
- 23:44What's that? Let's say ASAP worked perfectly.
- 23:47It tells us exactly why a model denied a loan.
- 23:50It says I denied this loan because of the applicant's zip
- 23:53code. Which is a huge red flag for
- 23:55bias. That's textbook redlining.
- 23:56Right, SHAP has done its job. It explained the why, but the
- 24:00explanation itself is just information.
- 24:02It doesn't fix the problem. The math is fair in how it
- 24:06calculates the contribution. It accurately reports that the
- 24:09zip code was the cause. But the reality it reveals is
- 24:12deeply unfair. That is a profound distinction.
- 24:15SHAP is a mirror. It reflects exactly what the
- 24:18model learned from the data you gave it.
- 24:20If the data has historical bias baked into it, the model will
- 24:24learn it and SHA tool dutifully report back.
- 24:27Yes, I am biased because of feature X.
- 24:29So explainability isn't the solution to ethical AI, it's
- 24:32just the diagnostic tool. You still need the human in the
- 24:35loop to look at that SHA plot and say that's wrong.
- 24:38We need to retrain, we need to fix the data.
- 24:41Exactly. The tool reveals the flaw, The
- 24:43human still has to fix it. Well, on that note, go check
- 24:46your models, watch out for the snow, and try to avoid creating
- 24:49too many five year old millionaires in your validation
- 24:51sets. Sound advice.
- 24:53We'll catch you on the next deep dive.