Course Content

# Python for Data Science: Handwritten Digits Recognition

Python for Data Science: Handwritten Digits Recognition

## Confusion Matrix

In machine learning, a confusion matrix is a table often used to evaluate the performance of a classification model. The confusion matrix summarizes the model's predictions and how they compare to the actual values.

In Scikit-learn (`sklearn`

), the `confusion_matrix`

function from the `sklearn.metrics`

module can generate a confusion matrix. The function takes two arguments: the true labels and the predicted labels. It returns a square matrix with rows and columns corresponding to the true and predicted labels.

The confusion matrix contains four values: true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN). These values represent the number of correct and incorrect predictions made by the model.

The matrix can calculate metrics such as accuracy, precision, recall, and F1 score. For example, accuracy can be calculated as (TP + TN) / (TP + TN + FP + FN).

# Task

- Pass the two vectors
`y_test`

and`Y_pred`

to see the results.

Everything was clear?