DOC Added example for plot_confusion_matrix (#16361)
This commit is contained in:
parent
daec09e6b4
commit
636e54a6c8
|
|
@ -176,6 +176,22 @@ def plot_confusion_matrix(estimator, X, y_true, labels=None,
|
|||
Returns
|
||||
-------
|
||||
display : :class:`~sklearn.metrics.ConfusionMatrixDisplay`
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> import matplotlib.pyplot as plt # doctest: +SKIP
|
||||
>>> from sklearn.datasets import make_classification
|
||||
>>> from sklearn.metrics import plot_confusion_matrix
|
||||
>>> from sklearn.model_selection import train_test_split
|
||||
>>> from sklearn.svm import SVC
|
||||
>>> X, y = make_classification(random_state=0)
|
||||
>>> X_train, X_test, y_train, y_test = train_test_split(
|
||||
... X, y, random_state=0)
|
||||
>>> clf = SVC(random_state=0)
|
||||
>>> clf.fit(X_train, y_train)
|
||||
SVC(random_state=0)
|
||||
>>> plot_confusion_matrix(clf, X_test, y_test) # doctest: +SKIP
|
||||
>>> plt.show() # doctest: +SKIP
|
||||
"""
|
||||
check_matplotlib_support("plot_confusion_matrix")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue