|
62 | 62 | scores = -np.log10(selector.pvalues_) |
63 | 63 | scores /= scores.max() |
64 | 64 | plt.bar(X_indices - .45, scores, width=.2, |
65 | | - label=r'Univariate score ($-Log(p_{value})$)', color='darkorange', |
66 | | - edgecolor='black') |
| 65 | + label=r'Univariate score ($-Log(p_{value})$)') |
67 | 66 |
|
68 | 67 | # ############################################################################# |
69 | 68 | # Compare to the weights of an SVM |
|
75 | 74 | svm_weights = np.abs(clf[-1].coef_).sum(axis=0) |
76 | 75 | svm_weights /= svm_weights.sum() |
77 | 76 |
|
78 | | -plt.bar(X_indices - .25, svm_weights, width=.2, label='SVM weight', |
79 | | - color='navy', edgecolor='black') |
| 77 | +plt.bar(X_indices - .25, svm_weights, width=.2, label='SVM weight') |
80 | 78 |
|
81 | 79 | clf_selected = make_pipeline( |
82 | 80 | SelectKBest(f_classif, k=4), MinMaxScaler(), LinearSVC() |
|
89 | 87 | svm_weights_selected /= svm_weights_selected.sum() |
90 | 88 |
|
91 | 89 | plt.bar(X_indices[selector.get_support()] - .05, svm_weights_selected, |
92 | | - width=.2, label='SVM weights after selection', color='c', |
93 | | - edgecolor='black') |
| 90 | + width=.2, label='SVM weights after selection') |
94 | 91 |
|
95 | 92 |
|
96 | 93 | plt.title("Comparing feature selection") |
|
0 commit comments