Skip to content

Commit d39134b

Browse files
qinhanmin2014adrinjalali
authored andcommitted
MNT Reorder parameters in plot_confusion_matrix (scikit-learn#15645)
* MNT Reorder parameters in plot_confusion_matrix * MNT Reorder parameters in plot_confusion_matrix * address comment
1 parent c652a61 commit d39134b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

sklearn/metrics/_plot/confusion_matrix.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ def plot(self, include_values=True, cmap='viridis',
117117
return self
118118

119119

120-
def plot_confusion_matrix(estimator, X, y_true, sample_weight=None,
121-
labels=None, display_labels=None,
122-
include_values=True, normalize=None,
120+
def plot_confusion_matrix(estimator, X, y_true, labels=None,
121+
sample_weight=None, normalize=None,
122+
display_labels=None, include_values=True,
123123
xticks_rotation='horizontal',
124124
values_format=None,
125125
cmap='viridis', ax=None):
@@ -138,14 +138,19 @@ def plot_confusion_matrix(estimator, X, y_true, sample_weight=None,
138138
y : array-like of shape (n_samples,)
139139
Target values.
140140
141-
sample_weight : array-like of shape (n_samples,), default=None
142-
Sample weights.
143-
144141
labels : array-like of shape (n_classes,), default=None
145142
List of labels to index the matrix. This may be used to reorder or
146143
select a subset of labels. If `None` is given, those that appear at
147144
least once in `y_true` or `y_pred` are used in sorted order.
148145
146+
sample_weight : array-like of shape (n_samples,), default=None
147+
Sample weights.
148+
149+
normalize : {'true', 'pred', 'all'}, default=None
150+
Normalizes confusion matrix over the true (rows), predicted (columns)
151+
conditions or all the population. If None, confusion matrix will not be
152+
normalized.
153+
149154
display_labels : array-like of shape (n_classes,), default=None
150155
Target names used for plotting. By default, `labels` will be used if
151156
it is defined, otherwise the unique labels of `y_true` and `y_pred`
@@ -154,11 +159,6 @@ def plot_confusion_matrix(estimator, X, y_true, sample_weight=None,
154159
include_values : bool, default=True
155160
Includes values in confusion matrix.
156161
157-
normalize : {'true', 'pred', 'all'}, default=None
158-
Normalizes confusion matrix over the true (rows), predicted (columns)
159-
conditions or all the population. If None, confusion matrix will not be
160-
normalized.
161-
162162
xticks_rotation : {'vertical', 'horizontal'} or float, \
163163
default='vertical'
164164
Rotation of xtick labels.

0 commit comments

Comments
 (0)