有没有办法评估模型是否能够识别有影响的变量(使用make_classification生成的变量)?

问题描述 投票:0回答:1

我有一个关于 scikit-learn 的 make_classification 的问题。我使用 make_classification (二元分类任务)创建了一个数据集,目的是测试不同模型区分重要特征和不太重要特征的能力。

如何设置一个实验来评估模型是否能够识别有影响的变量?

我查看了 make_classification 的文档,但不幸的是我没有进一步了解。

我设置了以下内容:

X,y = make_classification(n_samples=50000, n_features=10, n_informative=5, 
                    n_redundant=2, n_repeated=0, n_classes=2, n_clusters_per_class=2,
                          class_sep=1,
                   flip_y=0.01, weights=[0.9,0.1], shuffle=True, random_state=42)

谢谢您,非常感谢任何想法或建议。

python machine-learning scikit-learn classification feature-selection
1个回答
0
投票

我不太确定这是否是你的意思,但是sklearn中的很多(或者也许全部?)分类器都有

feature_importance
方法(参见例如随机森林分类器。这是多少“权重”或模型赋予每个特征的“重要性”对于回归模型也是如此

© www.soinside.com 2019 - 2024. All rights reserved.