refactor: Fix matrix display deprecation (#7729)

This commit is contained in:
Caeden Perelli-Harris 2022-10-27 14:15:15 +01:00 committed by GitHub
parent e906a5149a
commit e8915097c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
import numpy as np import numpy as np
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
from sklearn.datasets import load_iris from sklearn.datasets import load_iris
from sklearn.metrics import plot_confusion_matrix from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier from xgboost import XGBClassifier
@ -63,7 +63,7 @@ def main() -> None:
xgboost_classifier = xgboost(x_train, y_train) xgboost_classifier = xgboost(x_train, y_train)
# Display the confusion matrix of the classifier with both training and test sets # Display the confusion matrix of the classifier with both training and test sets
plot_confusion_matrix( ConfusionMatrixDisplay.from_estimator(
xgboost_classifier, xgboost_classifier,
x_test, x_test,
y_test, y_test,