Hi @amparore,
In the previous commit I made changes to help LEAF display for mutliclass problem. However, I noticed that the fidelity score is always very low (close to 0), then I realized the problem came from eval_whitebox_classifier function due to these lines:
BBY0, WBY0 = bb_classifier(NX0)[:,0], g.predict(SNX0)
BBY1, WBY1 = bb_classifier(NX1)[:,0], g.predict(SNX1)
if label_x0 == 1:
WBY0, WBY1 = 1 - WBY0, 1 - WBY1
BBCLS0, WBCLS0 = BBY0 > 0.5, WBY0 > 0.5
BBCLS1, WBCLS1 = BBY1 > 0.5, WBY1 > 0.5
In the first two lines, you retrieved the output probability of the 1st class and revert the probability if the label is 1 in the if statement.
To make it general for multiclass, I suggest changing the code above to:
BBY0, WBY0 = bb_classifier(NX0)[:,label_x0], g.predict(SNX0) # The label_x0 is now the index of the bb class
BBY1, WBY1 = bb_classifier(NX1)[:,label_x0], g.predict(SNX1) # while the g.predict already got coef and intercept from the bb class earlier
BBCLS0, WBCLS0 = BBY0 > 0.5, WBY0 > 0.5
BBCLS1, WBCLS1 = BBY1 > 0.5, WBY1 > 0.5
Now the fidelity becomes normal again

I will check to find if there are further lines to fix to fit the multiclass, but I think the change above is already fulfill. Would you mind if I create a commit for this afterwards?
Hi @amparore,
In the previous commit I made changes to help LEAF display for mutliclass problem. However, I noticed that the fidelity score is always very low (close to 0), then I realized the problem came from
eval_whitebox_classifierfunction due to these lines:In the first two lines, you retrieved the output probability of the 1st class and revert the probability if the label is 1 in the
ifstatement.To make it general for multiclass, I suggest changing the code above to:
Now the fidelity becomes normal again

I will check to find if there are further lines to fix to fit the multiclass, but I think the change above is already fulfill. Would you mind if I create a commit for this afterwards?