andosa / treeinterpreter

BSD 3-Clause "New" or "Revised" License
745 stars 140 forks source link

Replace usage of ForestClassifier and ForestRegressor with concrete classes #30

Closed iamDecode closed 4 years ago

iamDecode commented 4 years ago

My bad, I did not properly check #29, and this now causes an

ImportError: cannot import name 'ForestClassifier' from 'sklearn.ensemble' 

upon loading this library.

Sklearn 0.22+ seems to have removed public access to the base classes ForestClassifier and ForestRegressor. This PR changes the type checking to use more concrete implementations RandomForestClassifier, ExtraTreesClassifier, RandomForestRegressor, ExtraTreesRegressor. I think this is a better approach anyway, as sklearn may decide to add more forests type models which we cannot guarantee to support.