【问题标题】:In scikit-learn Stochastic Gradient Descent classifier, how to find the most influential independent variables?在scikit-learn Stochastic Gradient Descent分类器中,如何找到影响最大的自变量?
【发布时间】:2019-03-06 01:49:13
【问题描述】:

我这样做:

from sklearn.linear_model import SGDClassifier
sgclass = SGDClassifier(random_state=10)
sgclass.fit(X_train,y_train)
pred = sgclass.predict(X_test)
from sklearn.metrics import classification_report,accuracy_score
print(classification_report(y_test, pred))
print(accuracy_score(y_test, pred)) 

这些是关于模型召回率和精度的有用报告。

但是如何获取预测因变量的最有影响力的自变量呢?我从大约 12 位候选人开始,想看看他们在模型中的影响力排名。

【问题讨论】:

    标签: scikit-learn gradient-descent


    【解决方案1】:

    作为documentation指定,您可以使用 cof _ 属性来获取特征权重。特征的绝对值越大,它的重要性越大。

    您可以在Scikit的特征选择类中看到,SelectFromModel。从任何分类器中选择了最佳功能,该分类器具有 feature_importances _ cof _

    【讨论】:

      猜你喜欢
      • 2022-12-02
      • 1970-01-01
      • 2012-06-22
      • 2013-04-23
      • 2017-08-06
      • 2015-05-09
      • 2015-04-08
      • 2019-06-05
      相关资源
      最近更新 更多