【发布时间】:2022-08-16 23:42:24
【问题描述】:
现在我有这个,将特征重要性列为数字,我怎样才能将列名放在 x 轴上?
importance = model.coef_[0]
for i,v in enumerate(importance):
print(\'Feature: %0d, Score: %.5f\' % (i,v))
plot feature importance
pyplot.bar([x for x in range(len(importance))], importance)
pyplot.show()
输出:
Feature: 0, Score: -0.11124
Feature: 1, Score: -0.04292
Feature: 2, Score: 0.00561
-
使用sklearn?问题中缺少信息。问题中没有明显的功能名称,那么您在哪里可以找到它们?
标签: python pandas dataframe matplotlib