I need a list of all scikit-learn classifiers that support the predict_proba()
method. Since the documentation provides no easy way of getting that information, how can get this programatically?
The predict method is used to predict the actual class while predict_proba method can be used to infer the class probabilities (i.e. the probability that a particular data point falls into the underlying classes).
Many Scikit-learn models, such as Tree-based methods, ensemble methods, kNN, and Naive Bayes have a predict_proba method; but these should really be thought of as giving scores rather than "true" probabilities.
Decision Tree Classifiers/Random Forests. Naive Bayes. Linear Discriminant Analysis. Logistic Regression.
The predict_proba() returns the number of votes for each class, divided by the number of trees in the forest. Your precision is exactly 1/n_estimators. If you want to see variation at the 5th digit, you will need 10**5 = 100,000 estimators, which is excessive.
from sklearn.utils.testing import all_estimators estimators = all_estimators() for name, class_ in estimators: if hasattr(class_, 'predict_proba'): print(name)
You can also use CalibratedClassifierCV to make any classifier into one that has predict_proba
.
This was asked before on SO, but I can't find it, so you should be excused for the duplicate ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With