numpy - Get a column of probability values for a certain class in python/sklearn -
when using randomforest in sklearn binary classification. know can use clf.predict(x) predicted class. , when use clf.predict_proba(x), array this: 
i think first column indicates probability of prediction? how can column probability of class being 1?
from randomforest.predict_proba docs:
predict_proba(x)predict class probabilities x.
returns:
p: [...] class probabilities of input samples. order of classes corresponds in attributeclasses_.
you can @ clf.classes_ attribute, see @ index class 1 appears, , access probabilities so:
prob_class_1 = clf.predict_proba(x)[:, i] where i index of class 1 in clf.classes_.
Comments
Post a Comment