【发布时间】:2017-05-28 10:49:14
【问题描述】:
我正在使用以下代码进行特征重要性计算。
from matplotlib import pyplot as plt
from sklearn import svm
def features_importances(coef, names):
imp = coef
imp,names = zip(*sorted(zip(imp,names)))
plt.barh(range(len(names)), imp, align='center')
plt.yticks(range(len(names)), names)
plt.show()
features_names = ['input1', 'input2']
svm = svm.SVC(kernel='linear')
svm.fit(X, Y)
feature_importances(svm.coef_, features_names)
我如何能够计算非线性内核的特征重要性,这在给定的示例中没有给出预期的结果。
【问题讨论】:
-
检查this topic。
标签: python machine-learning scikit-learn svm