如何在scikit-learn中列出所有分类/回归/聚类算法?

时间:2017-02-10 13:14:49

标签: python machine-learning scikit-learn

How to list all scikit-learn classifiers that support predict_proba()类似,我想检索scikit-learn中当前支持的所有分类/回归/聚类算法的列表。

2 个答案:

答案 0 :(得分:6)

合并How to list all scikit-learn classifiers that support predict_proba()http://scikit-learn.org/stable/modules/classes.html#module-sklearn.base会产生解决方案:

from sklearn.utils.testing import all_estimators
from sklearn import base

estimators = all_estimators()

for name, class_ in estimators:
    if issubclass(class_, base.ClassifierMixin):
        print(name)

或使用任何其他基类:ClusterMixin,RegressorMixin,TransformerMixin。

答案 1 :(得分:1)

这是最新的解决方案:

from sklearn.utils import all_estimators

estimators = all_estimators(type_filter='regressor')

all_regs = []
for name, RegressorClass in estimators:
    print('Appending', name)
    reg = RegressorClass()
    all_regs.append(reg)