22
votes

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?

2

2 Answers

53
votes
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 ;)

2
votes

AdaBoostClassifier

BaggingClassifier

BayesianGaussianMixture

BernoulliNB

CalibratedClassifierCV

ComplementNB

DecisionTreeClassifier

ExtraTreeClassifier

ExtraTreesClassifier

GaussianMixture

GaussianNB

GaussianProcessClassifier

GradientBoostingClassifier

KNeighborsClassifier

LabelPropagation

LabelSpreading

LinearDiscriminantAnalysis

LogisticRegression

LogisticRegressionCV

MLPClassifier

MultinomialNB

NuSVC

QuadraticDiscriminantAnalysis

RandomForestClassifier

SGDClassifier

SVC

_BinaryGaussianProcessClassifierLaplace

_ConstantPredictor