confusion matrix of pickled random forest model

Viewed 106

Is it possible to recunstruct the full confusion matrix of the out-of-bag validation only with the model saved as pickle-dump?

mymodel.oob_score_ reports an OOB score of 0.75682

I found here that is possible to extract the predicted labels for this model like this:

pred_train = numpy.argmax(mymodel.oob_decision_function_,axis=1)

But are the train labels also somewhere saved in the model-file or not?

1 Answers

It depends on what you exported with pickle.dump(), but in general, if you only exported the random forest, then no.

sklearn.ensemble.RandomForestClassifier only has these attributes and the ground truth is not one of them.

oob_decision_function only stores an array of size (n_samples, n_classes) so you cannot get them from there. There are no other attributes that store the oob ground truth.

Related