We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a4bd37 commit 0447dd9Copy full SHA for 0447dd9
sklearn/inspection/_permutation_importance.py
@@ -100,6 +100,21 @@ def permutation_importance(estimator, X, y, scoring=None, n_repeats=5,
100
----------
101
.. [BRE] L. Breiman, "Random Forests", Machine Learning, 45(1), 5-32,
102
2001. https://doi.org/10.1023/A:1010933404324
103
+
104
+ Examples
105
+ --------
106
+ >>> from sklearn.linear_model import LogisticRegression
107
+ >>> from sklearn.inspection import permutation_importance
108
+ >>> X = [[1, 9, 9],[1, 9, 9],[1, 9, 9],
109
+ ... [0, 9, 9],[0, 9, 9],[0, 9, 9]]
110
+ >>> y = [1, 1, 1, 0, 0, 0]
111
+ >>> clf = LogisticRegression().fit(X, y)
112
+ >>> result = permutation_importance(clf, X, y, n_repeats=10,
113
+ ... random_state=0)
114
+ >>> result.importances_mean
115
+ array([0.4666..., 0. , 0. ])
116
+ >>> result.importances_std
117
+ array([0.2211..., 0. , 0. ])
118
"""
119
if not hasattr(X, "iloc"):
120
X = check_array(X, force_all_finite='allow-nan', dtype=None)
0 commit comments