from sklearn import ensemble
model = ensemble.RandomForestClassifier(n_estimators=10)
model.fit(x,y)
predictions = model.predict(new)
I know predict() uses predict_proba() to get the predictions, by computing the mean of the predicted class probabilities of the trees in the forest.
I want to get the result of predict_proba() for the class predicted by the predict() method.
What I'm doing is: first call predict() like in the above code, and for the probability I'm extracting the max probability from the trees like so:
all_probabilities = model.predict_proba()
class_probabilities = np.array([])
for tree in all_probabilities:
class_probabilites = np.append(class_probabilities, tree.max())
Is this correct? If not, how can I extract the probability for the predicted class?