nredell / shapFlex

An R package for computing asymmetric Shapley values to assess causality in any trained machine learning model
Other
71 stars 7 forks source link

Question: Sigma Unique #11

Closed 1989-juliana-h closed 4 years ago

1989-juliana-h commented 4 years ago

Hello, thanks a lot for implementing the idea of decomposing the R2 Shapley decomposition in R. I've tried to understand and implement all steps you mention in your paper. The main important thing for me is the calculation of the sigma unique (due to feature correlations). However, by applying the formula in the paper I receive values higher than one. So I was wondering whether I have to replace the real y by the predicted y in the counter of the formula?

nredell commented 4 years ago

Fair question. Thanks for bringing it up. I have this package pretty torn apart behind the scenes as I'm reworking it to incorporate causality. That doesn't answer your question, but give me a day or three, and I'll code up R^2 and sigma up with a worked example in the README here. I could answer off of the top of my head, but there's a good chance that I'd mistype.

nredell commented 4 years ago

Alright. Where to start? A lot of this is a note-to-self. The code used to calculate sigma in the report and now returned from the r2() function is spot on (testing and contributions always welcome); however, equation 7 in the paper is incorrect. Sorry for the confusion; bit of a time waster when that happens. I'll have to fix and re-upload. On that note, the formula below is the one we want.

code_1

There may be some degenerate cases that I've missed but the following should hold:

code_2