There are several popular performance metrics used for evaluating regression and classification models. Some of them are given below:
# Regression Metrics:
## Mean Absolute Error (MAE):
Mean Absolute Error measures the average absolute differences between the predicted and actual values. It is defined as:
$$MAE = \frac{1}{n} \sum_{i=1}^{n} \mid y_i - \hat{y}_i \mid$$
Where n is the number of observations, yi is the actual value, and ŷi is the predicted value.
## Mean Squared Error (MSE):
Mean Squared Error measures the average squared differences between the predicted and actual values. It is defined as:
$$MSE = \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2$$
MSE gives higher weightage to large differences between actual and predicted values compared to MAE.
## Root Mean Squared Error (RMSE):
Root Mean Squared Error is the square root of the MSE. It is defined as:
$$RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2}$$
RMSE is more interpretable than MSE as it is in the same units as the dependent variable.
# Classification Metrics:
## Confusion Matrix:
Confusion matrix is a table used to evaluate the performance of a classification model by comparing predicted and actual classes.
Here, True Positives (TP) are the number of correct positive predictions, True Negatives (TN) are the number of correct negative predictions, False Positives (FP) are the number of incorrect positive predictions, and False Negatives (FN) are the number of incorrect negative predictions.
## Accuracy:
Accuracy is the most commonly used metric to evaluate classification models. It is defined as:
$$Accuracy = \frac{TP+TN}{TP+FP+TN+FN}$$
Accuracy gives a general idea of the model’s performance, but it can be misleading in imbalanced datasets.
## Precision:
Precision measures how many of the positive predictions are actually positive. It is defined as:
$$Precision = \frac{TP}{TP+FP}$$
Precision is suitable for class imbalanced datasets, where the number of negative instances is significantly higher.
## Recall:
Recall measures how many actual positives were correctly classified as positive. It is defined as:
$$Recall = \frac{TP}{TP+FN}$$
Recall is more critical to use when the cost of false negatives is high.
## F1 Score:
F1 Score is the harmonic mean of Precision and recall. It is defined as:
$$F1 Score = 2*\frac{Precision * Recall}{Precision + Recall}$$
F1 Score is a better metric when both Precision and Recall are critical.