Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6299bc2

Browse files
Bunkus1glemaitre
authored andcommitted
EXA remove warning when setting yticks in permutation importances examples (scikit-learn#19385)
1 parent bdf39ae commit 6299bc2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/inspection/plot_permutation_importance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@
130130
y_ticks = np.arange(0, len(feature_names))
131131
fig, ax = plt.subplots()
132132
ax.barh(y_ticks, tree_feature_importances[sorted_idx])
133-
ax.set_yticklabels(feature_names[sorted_idx])
134133
ax.set_yticks(y_ticks)
134+
ax.set_yticklabels(feature_names[sorted_idx])
135135
ax.set_title("Random Forest Feature Importances (MDI)")
136136
fig.tight_layout()
137137
plt.show()

examples/inspection/plot_permutation_importance_multicollinear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 8))
6161
ax1.barh(tree_indices,
6262
clf.feature_importances_[tree_importance_sorted_idx], height=0.7)
63-
ax1.set_yticklabels(data.feature_names[tree_importance_sorted_idx])
6463
ax1.set_yticks(tree_indices)
64+
ax1.set_yticklabels(data.feature_names[tree_importance_sorted_idx])
6565
ax1.set_ylim((0, len(clf.feature_importances_)))
6666
ax2.boxplot(result.importances[perm_sorted_idx].T, vert=False,
6767
labels=data.feature_names[perm_sorted_idx])

0 commit comments

Comments
 (0)