eli5 icon indicating copy to clipboard operation
eli5 copied to clipboard

PermutationImportance uses CV splitter indexes incorrectly

Open zeromh opened this issue 3 years ago • 0 comments

The error is in PermutationImportance.fit when using cv=KFold or some other sklearn splitter.

sklearn splitters return the location indexes (i.e. iloc) of the rows, whereas PermutationImportance.fit is treating these as label indexes (i.e. loc).

This only gives the correct result when the index labels are the same as the index locations (e.g. when you have the default RangeIndex). If the dataframe has any other index, this will use the wrong splits or create a KeyError.

zeromh avatar Sep 17 '21 17:09 zeromh