I would like to use the oob error as the scoring method for my random forest classifier in grid search. I have read this can be done using make_scorer but I keep getting errors. This code works if I remove the scorer in the grid search but when I add the scorer, I get an error saying "AttributeError: RandomForestClassifier object has no attribute 'obb_score_'." I have read many discussions where others have had issues trying to use the oob_score for this purpose but I could not come up with any examples of code that actually worked for my situation.

Code which yields attribute error

I have tried this with a pipeline of pca and rf, I have tried to gather the oob_scores_ for each model separate from the grid search scoring to collect them into a dataframe, and countless other small tweaks and rearrangements of code to try to get it to work, but I always end up with either this attribute error or a positional argument error. I'd appreciate any advice.

0

There are 0 answers