如何列出所有支持 predict_proba() 的 scikit-learn 分类器 [英] How to list all scikit-learn classifiers that support predict_proba()

查看:58
本文介绍了如何列出所有支持 predict_proba() 的 scikit-learn 分类器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要支持 predict_proba() 方法的所有 scikit-learn 分类器的列表.由于文档没有提供获取该信息的简单方法,如何以编程方式获取此信息?

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?

推荐答案

from sklearn.utils.testing import all_estimators

estimators = all_estimators()

for name, class_ in estimators:
    if hasattr(class_, 'predict_proba'):
        print(name)

您还可以使用 CalibratedClassifierCV 将任何分类器转换为具有 predict_proba 的分类器.

You can also use CalibratedClassifierCV to make any classifier into one that has predict_proba.

这之前在 SO 上被问过,但我找不到,所以你应该原谅重复;)

This was asked before on SO, but I can't find it, so you should be excused for the duplicate ;)

这篇关于如何列出所有支持 predict_proba() 的 scikit-learn 分类器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆