Conversation
|
@andreybavt To check what it's doing, you can check the demo projects: 1. Zillow price prediction - regression 2. German credit scoring - binary classification 5. ENRON - multi classification BEFORE AFTER |
andreybavt
left a comment
There was a problem hiding this comment.
I left some minor comments, plus there are a few "Code smells" from Sonar. Let me know if you have time to finish this PR, otherwise, I can do it myself @alexcombessie
| const explanationSumByFeature: object = {}; | ||
| topFeatures.forEach((element, index) => { | ||
| explanationSumByFeature[element] = explanationSum[index]; | ||
| }); |
There was a problem hiding this comment.
simplification nitpick: explanationSum auxiliary array (and some other aux variables) creation can be avoided if you replace lines 158-170 with something like this:
// Compute the sum of SHAP explanations by feature
const explanationSumByFeature: { [name: string]: number } = _.reduce(
_.values(this.fullExplanations),
(acc, labelExplanations) => {
_.forOwn(labelExplanations, (featureName, explainValue) => {
acc[explainValue] = (acc[explainValue] || 0) + featureName;
});
return acc;
}, {}
)here I'm using lodash that you can import with import _ from "lodash";
There was a problem hiding this comment.
Sure, but I wonder if this version is not less readable? Also, are you 100% sure this is the same formula as the code I wrote? Just asking, since I spent over 3 hours to craft the formula and make sure it was correct.
There was a problem hiding this comment.
If I'm not missing anything, your transforming Category->feature->explanation nested dictionary into feature->explanation dictionary by summing up explanations by feature across categories
There was a problem hiding this comment.
yep exactly, with sorting
Thanks! I took care of the code smells directly in 483a246 For the rest, I won't have time before next week. This afternoon I need to work on the EIC proposal, on which I am already quite late. So yeah if you can finish it, that would be fantastic, thanks! |
|
Kudos, SonarCloud Quality Gate passed! |
|
Kudos, SonarCloud Quality Gate passed! |
















https://giskard.youtrack.cloud/issue/GSK-158