gpt4 book ai didi

python - mlxtend 中 StackingClassifier 函数中的元分类器是什么?

转载 作者:行者123 更新时间:2023-11-30 09:46:17 25 4
gpt4 key购买 nike

在 mlxtend 库中,有一个用于堆叠的集成学习元分类器,称为“StackingClassifier”。

以下是 StackingClassifier 函数调用的示例:

sclf = StackingClassifier(classifiers=[clf1, clf2, clf3], 
meta_classifier=lr)

这里的meta_classifier是什么?它有什么用?

最佳答案

什么是堆叠?

Stacking is an ensemble learning technique to combine multiple classification models via a meta-classifier. The individual classification models are trained based on the complete training set; then, the meta-classifier is fitted based on the outputs -- meta-features -- of the individual classification models in the ensemble.

来源:StackingClassifier-mlxtend

因此,meta_classifier 参数可以帮助我们选择分类器来适应各个模型的输出。

示例:

假设您使用了 3 个二元分类模型(例如 LogisticRegression、DT 和 KNN)进行堆叠。假设 0, 0, 1 是模型预测的类别。现在我们需要一个分类器来对预测值进行多数投票。该分类器就是meta_classifier。在此示例中,它将选择 0 作为预测类别。

您也可以将其扩展为 prob 值。

引用mlxtend-API了解更多信息

关于python - mlxtend 中 StackingClassifier 函数中的元分类器是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52250025/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com