The mathematics behind Shapley Values

  Рет қаралды 27,632

A Data Odyssey

A Data Odyssey

Күн бұрын

Shapley values are a fair way to divide the value of a game amongst its players. We explain the mathematics behind the Shapley value formula. To understand why it is fair, we also discuss the Shapley value axioms that the formula is derived from. The formula may seem scary but you will find it has an intuitive explanation.
*NOTE*: You will now get the XAI course for free if you sign up (not the SHAP course)
SHAP course: adataodyssey.c...
XAI course: adataodyssey.c...
Newsletter signup: mailchi.mp/409...
Read the companion article (no-paywall link): towardsdatasci...
Medium: / conorosullyds
Twitter: / conorosullyds
Mastodon: sigmoid.social...
Website: adataodyssey.com/

Пікірлер: 75
@adataodyssey
@adataodyssey 7 ай бұрын
*NOTE*: You will now get the XAI course for free if you sign up (not the SHAP course) SHAP course: adataodyssey.com/courses/shap-with-python/ XAI course: adataodyssey.com/courses/xai-with-python/ Newsletter signup: mailchi.mp/40909011987b/signup
@abstractqqq
@abstractqqq Жыл бұрын
Good job sir. Very few in the ML (industry) will go this deep. Seeing more like-minded people always feel great.
@adataodyssey
@adataodyssey Жыл бұрын
Thank you! I always feel a bit uncomfortable if I don't have some sort of an understanding of the theory :)
@santizdr
@santizdr 4 ай бұрын
Best channel to dig deep into XAI. It would be great a video about the state of art of XAI applied on LLMs.
@adataodyssey
@adataodyssey 4 ай бұрын
Thanks Santi! I will consider this however my interests are more in computer vision at the moment
@HenryCagnini
@HenryCagnini 8 ай бұрын
That's a great video to explain the concept of Shapley values. Many thanks!
@adataodyssey
@adataodyssey 8 ай бұрын
Thanks Henry! I’m glad you found it useful :)
@helenli615
@helenli615 2 ай бұрын
Amazing job explaining this! I'm using it for macroeconomic analysis and thank you so much!
@adataodyssey
@adataodyssey 2 ай бұрын
Glad I could help :)
@umarkhan-hu7yt
@umarkhan-hu7yt 7 ай бұрын
Dear Odyssey you are doing great. Keep continue and hit hard on all XAI models for a layman.
@adataodyssey
@adataodyssey 7 ай бұрын
Thank you Umar! Will do :)
@mugiwxrx6282
@mugiwxrx6282 Жыл бұрын
thank you sir, that seems more clear in my mind !
@adataodyssey
@adataodyssey Жыл бұрын
I’m glad it helped!
@v-ba
@v-ba 4 ай бұрын
Great explanation, thank you very much
@adataodyssey
@adataodyssey 4 ай бұрын
Thanks!
@muhammadawais581
@muhammadawais581 3 ай бұрын
hats off to you for such a nice explanation.
@adataodyssey
@adataodyssey 3 ай бұрын
Thanks Muhammad!
@shadmohammed618
@shadmohammed618 8 ай бұрын
Great explanation, thanks very much. 🙂
@adataodyssey
@adataodyssey 8 ай бұрын
No problem Shad! I’m glad you found it useful
@yelancho
@yelancho 5 ай бұрын
Appreciate a lot Prof Odyssey!Shaply values is now a more clear concept in my mind!
@adataodyssey
@adataodyssey 5 ай бұрын
Thanks Ye! I'm glad you found it useful :)
@miguelgarciaortegon
@miguelgarciaortegon 7 ай бұрын
Great explanation, thank you!
@adataodyssey
@adataodyssey 7 ай бұрын
I'm glad you found it useful Miguel :)
@Ericfrodrigues
@Ericfrodrigues 3 ай бұрын
Sou outra pessoa depois de conhecer Shap Values!! ----> I'm a different person after getting to know Shap Values!! Thanks a lot!
@adataodyssey
@adataodyssey 3 ай бұрын
I agree Eric! It is an interesting topic :)
@silver_soul98
@silver_soul98 6 ай бұрын
Bro that was a nice explanation. thanks so much.
@adataodyssey
@adataodyssey 6 ай бұрын
No problem :) I’m glad it was useful
@abdelbaki8625
@abdelbaki8625 4 ай бұрын
I don't understand
@smithanair787
@smithanair787 Жыл бұрын
Great video! Can you make a video on how exactly the Kernel SHAP and TreeSHAP works?
@adataodyssey
@adataodyssey Жыл бұрын
Thank you Smitha! I will consider that. But, to be honest, it will take me some time to fully understand the algorithms first.
@smithanair787
@smithanair787 Жыл бұрын
@@adataodyssey Thank you!
@adataodyssey
@adataodyssey Жыл бұрын
@@smithanair787 by the way, the course goes into a bit more detail on the difference between kernelSHAP and treeSHAP. Otherwise you might find this article helpful: towardsdatascience.com/kernelshap-vs-treeshap-e00f3b3a27db
@yaelefrat7677
@yaelefrat7677 2 күн бұрын
Amazing Video! Thank you very much! I do have one question regarding the coalition values of 3 players game: if the value of the prize (first, second, or third) can only be obtain when there is a coalition of 3, then what is the meaning of a coalition of 2 players: C_12, C_13, C_23 ?
@adataodyssey
@adataodyssey Күн бұрын
These are the coalition values (i.e. prize money) if only the 2 players were in a team. To get these, I said "we need to go back in time a few more times". This is so that each alternative team could play the game and win prize money. Obviously, this is not possible. In reality, we must estimate these values. So, the actual prize money of $10000 must be split across the 3 players. However, to find a fair way to divide the money we need to know how much players would have won in alternative teams of 2 or less members.
@civilengineeringonlinecour7143
@civilengineeringonlinecour7143 Ай бұрын
Awesome lecture
@adataodyssey
@adataodyssey Ай бұрын
@@civilengineeringonlinecour7143 thanks glad it could help!
@adataodyssey
@adataodyssey Ай бұрын
@@civilengineeringonlinecour7143 I’m glad you found it useful!
@dennisestenson7820
@dennisestenson7820 10 ай бұрын
I really don't like that this subject is presented and studied as "games" when the underlying math is so incredibly enlightening and important.
@adataodyssey
@adataodyssey 10 ай бұрын
This is a term that comes from "game theory". Rest assured that the "games" it deals with are very serious! Perhaps the example I've chosen is a bit silly but I was hoping that it would help the target audience relate to the concepts :)
@elenagolovach384
@elenagolovach384 Жыл бұрын
Thanks very much
@adataodyssey
@adataodyssey Жыл бұрын
No problem, Elena!
@Empobaer
@Empobaer Жыл бұрын
Great video, formula was well explained! Though, I do have a question. What is the Intuition behind P(C1-C0) = 2/6 at 7:11 ? Because intuitively I would have thought there is only one way how player 1 can start its new coalition and thus I would have thought the weight should be 1/6. I see that if we look into the formula on how to calculate the weights, we obtain (p-|S|-1)!=2 and thus (1*2)/6=1/3, but I still miss the intuition behind why we need the (p-|Sl-1)!. Where am I thinking wrong?
@adataodyssey
@adataodyssey Жыл бұрын
Great question! Keep in mind that to receive the full value of the game all 3 players need to participate. So, after P1 joins, there are 2 ways for the full coalition to form -- P2 joins then P3 or P3 joins then P2. In other words, there will be 2 scenarios where P1 makes a marginal contribution to a team of no players. Does that make sense?
@adataodyssey
@adataodyssey Жыл бұрын
If not, then this article may help. It calculates the values in a slightly different way which may be more intuitive to you. www.analyticsvidhya.com/blog/2019/11/shapley-value-machine-learning-interpretability-game-theory/
@Empobaer
@Empobaer Жыл бұрын
​@@adataodyssey Thank you for your fast reply, indeed the blog post was very useful for an intuitive understanding! Anyways your series on SHAP and Shapley values was a very helpful introduction. Now I only need to fully understand Kernel SHAP, which will probably take a bit longer :)!
@lakshman587
@lakshman587 11 ай бұрын
The time machine thing really got me hahaha!! I was wondering how can individual values be calculated!! Thanks for clear explanation!!
@adataodyssey
@adataodyssey 11 ай бұрын
No problem Lakshman! Are there any other related concepts you're interested in learning about?
@lakshman587
@lakshman587 11 ай бұрын
@@adataodyssey I would like to learn about ChatGPT like how transformers work.
@adataodyssey
@adataodyssey 11 ай бұрын
@@lakshman587 This is a bit out of my comfort zone tbh. My content is more aimed towards computer vision and explainable AI. I was considering doing a tutorial on how you can use the GPT API though!
@lakshman587
@lakshman587 11 ай бұрын
@@adataodyssey Ok No problem, can we have a video about how diverse counterfacuals work under the hood, we currently are using DiCE package from interpretml repo. I would like to know how these counterfacuals are getting generated!
@adataodyssey
@adataodyssey 11 ай бұрын
@@lakshman587 will look into that!
@rajivh4760
@rajivh4760 2 ай бұрын
Great video!!! Why do we consider the players joining in sequence. Why not just use the unique ways in which the teams can be formed?
@adataodyssey
@adataodyssey 2 ай бұрын
You need to calculate the average marginal contribution of a player. The marginal contribution will change depending on which team members are in the team before the player joins. So you need to consider all possible sequences in which the players can join to form the team.
@QindeelZahra
@QindeelZahra 25 күн бұрын
Thanks for the video really useful, i am facing issue in understanding how you calculated the value for Player (P2) in your companion article. A little explanation on the weights would help there as i am struggling to get the value $3750. Thanks
@adataodyssey
@adataodyssey 24 күн бұрын
Embrase the struggle! Will you will learn more through trying to solve it :)
@hasnainayub2369
@hasnainayub2369 7 ай бұрын
Great explanation! I have a question though. Why don't the shap values for each feature (from the waterfall plot) add up to the predicted output at that particular observation?
@adataodyssey
@adataodyssey 7 ай бұрын
They do if you also add the average prediction across all the instances in the dataset: f(x) = E[f(x)] + sum(shap values) You can see the average prediction, i.e. E[f(x)], on the bottom of the waterfall plot :)
@hasnainayub2369
@hasnainayub2369 7 ай бұрын
Got it ! Thanks mate @@adataodyssey
@QuantizedFields
@QuantizedFields 11 ай бұрын
This is a very good explanation. However, I found it a bit confusing when you were referring to "Player-1" as "You". Because it is not clear who I am from the animation, am I "Player-1" or "Player-2" ? It would be better if you simply refer to the animation/picture and say "Player-1" or "Player-2" instead of "You". Thanks for your great work!
@adataodyssey
@adataodyssey 11 ай бұрын
Thanks for the input Daniya! When it comes to technical content, it is difficult to strike a balance between making it interesting and easy to understand. My goal was to get the audience engaged but I see how this can be confusing.
@adityababel3998
@adityababel3998 Жыл бұрын
Hello, can you make a video explaining the calculation of TreeSHAP??
@adataodyssey
@adataodyssey Жыл бұрын
Hi Aditya, this is already on my list of videos to do! I want to make a video about both Kernel SHAP and tree SHAP that go more in-depth into the algorithms.
@hasnainayub2369
@hasnainayub2369 7 ай бұрын
Could you please explain P(C1-C0) = 1/3 ? (at 7:12). The rest is very well explained.
@adataodyssey
@adataodyssey 7 ай бұрын
Remember, to get the prize money all players must eventually join the coalition. So, there are 2 ways that P1 can contribute to a coalition with no players (i.e. C0): - P1 joins then P2 then P3 - P1 joins the P3 then P2 So they make the marginal contribution C1 - C0 in 2/6 = 1/3 ways the coalition of 3 players can form.
@hasnainayub2369
@hasnainayub2369 7 ай бұрын
@@adataodyssey thank you so much ! How did i not see that :/
@adataodyssey
@adataodyssey 7 ай бұрын
@@hasnainayub2369 don't stress! It took me forever to understand
@cheeseybox
@cheeseybox 10 ай бұрын
Ur a legend
@adataodyssey
@adataodyssey 10 ай бұрын
Coming from you cheese vision, I take that as a great compliment!
@TheOzpad
@TheOzpad Жыл бұрын
Lekker vid
@abdelbaki8625
@abdelbaki8625 4 ай бұрын
what is the article reference for this information i need it for my studies emergency, please
@adataodyssey
@adataodyssey 4 ай бұрын
kzbin.info?event=video_description&redir_token=QUFFLUhqbktFYXFNVHVzc3NsTWpaYkc4Y3l3alZ0N3dmZ3xBQ3Jtc0trX2c3WmlOUVQwYW1USmJsaDh4YnpLV191dk5tOEdnOUtnVF9vZm5BbG8yTmRTaU56RXZNSE12Nkh2MjRITUZSLUZINUNPWmM3WFRlbnVGZWlscDFLZnFOZy1Xb0JiYm1RMnlQbVU2MEJ4R0hoUmJxMA&q=https%3A%2F%2Ftowardsdatascience.com%2Ffrom-shapley-to-shap-understanding-the-math-e7155414213b%3Fsk%3D329a1f042a0167162487f7bb3f0ffd46&v=UJeu29wq7d0
@mathieucordier9248
@mathieucordier9248 Жыл бұрын
Does Shap Value is adapted for imbalanced data set ? Because one assumption is that we consider equality of chance for players combination (at 6:00).
@adataodyssey
@adataodyssey Жыл бұрын
That's a good question! I haven't really thought about that. In ML we don't assume equal chance for all feature values. We use the empirical distributions of the features. So you don't have to worry about that assumption for unbalanced features. For unbalanced targets, I'd say you should be fine as long as the model is still making accurate predictions. E.g. if it is always predicting one class then the SHAP values won't be meaningful.
@seanjohn6956
@seanjohn6956 5 ай бұрын
just stick to the explanations no need for the jarring adlibs
@adataodyssey
@adataodyssey 5 ай бұрын
That's boring...
Shapley Values for Machine Learning
11:06
A Data Odyssey
Рет қаралды 15 М.
She's very CREATIVE💡💦 #camping #survival #bushcraft #outdoors #lifehack
00:26
Spongebob ate Michael Jackson 😱 #meme #spongebob #gmod
00:14
Mr. LoLo
Рет қаралды 11 МЛН
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 3,5 МЛН
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 28 МЛН
4 Significant Limitations of SHAP
6:35
A Data Odyssey
Рет қаралды 10 М.
The Reciprocals of Primes - Numberphile
15:31
Numberphile
Рет қаралды 1,6 МЛН
SHAP with Python (Code and Explanations)
15:41
A Data Odyssey
Рет қаралды 62 М.
The math behind Attention: Keys, Queries, and Values matrices
36:16
Serrano.Academy
Рет қаралды 248 М.
Why is there no equation for the perimeter of an ellipse‽
21:05
Stand-up Maths
Рет қаралды 2,2 МЛН
The Boundary of Computation
12:59
Mutual Information
Рет қаралды 1 МЛН
How to fairly split weird bills using GAME THEORY
16:45
Dr. Trefor Bazett
Рет қаралды 125 М.
Explainable AI explained! | #4 SHAP
15:50
DeepFindr
Рет қаралды 80 М.
She's very CREATIVE💡💦 #camping #survival #bushcraft #outdoors #lifehack
00:26