text_plain_output_1.png
from sklearn.datasets import load_digits

from sklearn.ensemble import RandomForestClassifier

from sklearn.metrics import confusion_matrix

import matplotlib.pyplot as plt

import seaborn as sm

from sklearn.datasets import load_digits
digits = load_digits()

plt.gray()

from sklearn.ensemble import RandomForestClassifier
classifier = RandomForestClassifier()
classifier.fit(x_train, y_train)

classifier.score(x_test, y_test)

y_predicted = classifier.predict(x_test)

from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_test, y_predicted)
cm

plt.figure(figsize=(10, 7))
sm.heatmap(cm, annot=True)
plt.xlabel('Predicted')
plt.ylabel('True')
plt.show()