Accuracy and Errors
Accuracy is a measure of how close a measured value is to the true or accepted value, while errors represent the difference between the measured and true values. Errors can be calculated using absolute error, relative error, or percent error formulas. Accuracy is one of the most basic and widely used metrics in classification tasks. It represents the ratio of correct predictions made by the model to the total number of predictions.

Formula:

Accuracy = (TP + TN) / (TP + TN + FP + FN)

Where:

TP: True Positives
TN: True Negatives
FP: False Positives
FN: False Negatives

Errors help quantify how far off the model’s predictions are from the actual outcomes. This is essential when high accuracy might mask poor performance in imbalanced datasets.
Types of Error:

1. Absolute Error = |Predicted - Actual|
2. Relative Error = |Predicted - Actual| / |Actual|
3. Percent Error = (Absolute Error / Actual) * 100

Predicted Value

Actual Value

16

True Positive

30

False Negative

10

False Positive

144

True Negative

Confusion Matrix

A confusion matrix is a table used to evaluate the performance of a classification model. It visualizes the model's predictions against the actual outcomes, showing how well it correctly identifies different categories. It helps understand where the model makes mistakes and where it performs well. A Confusion Matrix is a performance measurement tool for classification problems. Unlike simple accuracy, it provides a granular view of the classification results and highlights types of errors.

Components:

- TP: Model predicted "Positive", and it was actually "Positive".
- FP: Model predicted "Positive", but it was "Negative".
- FN: Model predicted "Negative", but it was "Positive".
- TN: Model predicted "Negative", and it was actually "Negative".



Importance of Confusion Matrix:

1. It allows class-wise analysis rather than an overall average.
2. Helps detect biases in the model .
3. It is essential for calculating precision, recall, specificity, and F1-score.

Line Chart

A line chart visualizing precision, recall, and F1-score typically shows how these metrics change over a range of values, often representing a model's performance at different thresholds or for varying data subsets. The X-axis usually represents the data or parameter being varied, while the Y-axis represents the value of each metric (precision, recall, and F1-score). This allows for easy comparison of how the model's performance changes with these variations.

Metric Definitions:

- Precision = TP / (TP + FP): How many predicted positives are actually correct?
- Recall = TP / (TP + FN): How many actual positives were captured?
- F1 Score = 2 * (Precision * Recall) / (Precision + Recall): Balances precision and recall.



When and Why to Use:

- High precision + low recall = Model is conservative.
- High recall + low precision = Model detects more positives but includes false alarms.
- F1 Score = Balanced metric.