I have a scikit learn RandomForestClassifier that returns 0s and 1s:
X = [ [2,1,1,1], [2,0,2,1], [3,1,1,1] , [3,1,1,1], [3,1,1,1] ] y = [ 0, 1, 1, 1, 1 ] rf = RandomForestClassifier(n_estimators=200, max_depth=5) rf.fit(X, y) X_test = [ [2, 0, 1, 0], [2,1,1,1] , [3,1,1,1] ] y_result = rf.predict(X_test)
I can rerun the classifier and get probabilities instead of values replacing with
y_result = rf.predict_proba(X_test)
But how can I get from scikit learn BOTH the result and the probability?
If I cannot get both results in the same run, does it make sense to run the probability and have a threshold, say 0.7, that if the probability is greater than the threshold then the result is 1 ?