python 所有分类算法列表[已关闭]

wmvff8tz  于 2023-01-24  发布在  Python
关注(0)|答案(4)|浏览(128)
    • 已关闭**。此问题需要超过focused。当前不接受答案。
    • 想要改进此问题吗?**更新此问题,使其仅关注editing this post的一个问题。

3天前关闭。
社区在3天前审查了是否重新讨论此问题,并将其关闭:
原始关闭原因未解决
Improve this question
我有一个分类问题,我想测试所有可用的算法,以测试他们在处理这个问题的性能。
如果您知道除以下所列算法之外的任何分类算法,请在此列出。

GradientBoostingClassifier()
DecisionTreeClassifier()
RandomForestClassifier()
LinearDiscriminantAnalysis()
LogisticRegression()
KNeighborsClassifier()
GaussianNB()
ExtraTreesClassifier()
BaggingClassifier()
r6hnlfcb

r6hnlfcb1#

答案没有提供完整的分类器列表,所以我在下面列出了它们。

from sklearn.tree import ExtraTreeClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm.classes import OneClassSVM
from sklearn.neural_network.multilayer_perceptron import MLPClassifier
from sklearn.neighbors.classification import RadiusNeighborsClassifier
from sklearn.neighbors.classification import KNeighborsClassifier
from sklearn.multioutput import ClassifierChain
from sklearn.multioutput import MultiOutputClassifier
from sklearn.multiclass import OutputCodeClassifier
from sklearn.multiclass import OneVsOneClassifier
from sklearn.multiclass import OneVsRestClassifier
from sklearn.linear_model.stochastic_gradient import SGDClassifier
from sklearn.linear_model.ridge import RidgeClassifierCV
from sklearn.linear_model.ridge import RidgeClassifier
from sklearn.linear_model.passive_aggressive import PassiveAggressiveClassifier    
from sklearn.gaussian_process.gpc import GaussianProcessClassifier
from sklearn.ensemble.voting_classifier import VotingClassifier
from sklearn.ensemble.weight_boosting import AdaBoostClassifier
from sklearn.ensemble.gradient_boosting import GradientBoostingClassifier
from sklearn.ensemble.bagging import BaggingClassifier
from sklearn.ensemble.forest import ExtraTreesClassifier
from sklearn.ensemble.forest import RandomForestClassifier
from sklearn.naive_bayes import BernoulliNB
from sklearn.calibration import CalibratedClassifierCV
from sklearn.naive_bayes import GaussianNB
from sklearn.semi_supervised import LabelPropagation
from sklearn.semi_supervised import LabelSpreading
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.svm import LinearSVC
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LogisticRegressionCV
from sklearn.naive_bayes import MultinomialNB  
from sklearn.neighbors import NearestCentroid
from sklearn.svm import NuSVC
from sklearn.linear_model import Perceptron
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
from sklearn.svm import SVC
from sklearn.mixture import DPGMM
from sklearn.mixture import GMM 
from sklearn.mixture import GaussianMixture
from sklearn.mixture import VBGMM
c90pui9n

c90pui9n2#

你可能想看看下面的问题:
How to list all scikit-learn classifiers that support predict_proba()
接受的答案显示了在支持predict_probas方法的scikit中获取所有估计量的方法。只需迭代并打印所有名称而不检查条件,即可获取所有估计量。(分类器、回归变量、聚类等)
仅对于分类器,请按如下所示进行修改,以检查实现ClassifierMixin的所有类

from sklearn.base import ClassifierMixin
from sklearn.utils.testing import all_estimators
classifiers=[est for est in all_estimators() if issubclass(est[1], ClassifierMixin)]
print(classifiers)

对于〉= 0.22的版本,请使用以下命令:

from sklearn.utils import all_estimators

而不是sklearn.utils.testing
注意事项:

  • 名称后缀为CV的分类器实现了内置的交叉验证(如LogisticRegressionCV、RidgeClassifierCV等)。
  • 有些是集成的,可以在输入参数中使用其他分类器。
  • 一些分类器如**_QDA**,_LDA是其他分类器的别名,可能会在scikit-learn的下一个版本中删除。

使用前应检查其各自的参考文档

6ie5vjzr

6ie5vjzr3#

另一种方法是使用from sklearn.utils import all_estimators模块,下面是导入所有分类器的示例:

from sklearn.utils import all_estimators

estimators = all_estimators(type_filter='classifier')

all_clfs = []
for name, ClassifierClass in estimators:
    print('Appending', name)
    try:
        clf = ClassifierClass()
        all_clfs.append(clf)
    except Exception as e:
        print('Unable to import', name)
        print(e)

Here's Colaboratory code与它的工作。

j9per5c4

j9per5c44#

您可以使用以下代码获取实际估计量名称:

from sklearn.utils import all_estimators

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

这是实际导入代码(sklearn 1.0.2)

from sklearn.tree import ExtraTreeClassifier, DecisionTreeClassifier
from sklearn.multioutput import ClassifierChain, MultiOutputClassifier
from sklearn.multiclass import OutputCodeClassifier, OneVsOneClassifier, OneVsRestClassifier
from sklearn.naive_bayes import BernoulliNB, GaussianNB, MultinomialNB, CategoricalNB, ComplementNB
from sklearn.calibration import CalibratedClassifierCV
from sklearn.semi_supervised import LabelPropagation, LabelSpreading, SelfTrainingClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis, QuadraticDiscriminantAnalysis
from sklearn.svm import LinearSVC, SVC, OneClassSVM, NuSVC
from sklearn import mixture
from sklearn.mixture import BayesianGaussianMixture, GaussianMixture
from sklearn.neural_network import MLPClassifier
from sklearn.neighbors import RadiusNeighborsClassifier, KNeighborsClassifier, NearestCentroid
from sklearn.linear_model import LogisticRegression, LogisticRegressionCV, Perceptron, SGDClassifier, \
                                RidgeClassifierCV, RidgeClassifier, PassiveAggressiveClassifier
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.ensemble import VotingClassifier, AdaBoostClassifier, GradientBoostingClassifier, \
                            BaggingClassifier, ExtraTreesClassifier, RandomForestClassifier, \
                            HistGradientBoostingClassifier, StackingClassifier
from sklearn.dummy import DummyClassifier
from sklearn.experimental import enable_halving_search_cv  # must be import before 
from sklearn.model_selection import GridSearchCV, HalvingGridSearchCV, HalvingRandomSearchCV, RandomizedSearchCV
from sklearn.pipeline import Pipeline
from sklearn.feature_selection import RFE, RFECV

估计量列表

  1. AdaBoost分类器
    1.装袋分类器
    1.贝叶斯高斯混合
    1.伯努利
    1.校准分类器CV
    1.分类NB
    1.分类器链
    1.补体NB
    1.决策树分类器
    1.虚拟分类器
    1.额外树分类器
    1.额外树分类器
    1.高斯混合
    1.高斯NB
    1.高斯过程分类器
    1.梯度提升分类器
    1.网格搜索CV
    1.半网格搜索CV
    1.减半随机搜索CV
    1.历史梯度提升分类器
  2. Knighbors分类器
    1.标签传播
    1.标签展开
    1.线性判别分析
    1.逻辑回归
    1.逻辑回归CV
  3. MLP分类器
    1.多输出分类器
    1.多名称NB
  4. NuSVC
  5. OneVsREST分类器
    1.管道
    1.二次判别分析
    1.射频消融
  6. RFECV
    1.半径邻域分类器
    1.随机森林分类器
    1.随机检索CV
  7. SGD分类器
    1.上腔静脉
    1.自训练分类器
    1.堆叠分类器
    1.投票分类器

相关问题