ai-cookbook / src /theory /metrics.qmd
Sébastien De Greef
chore: Update colorFrom in README.md and index.qmd
e3bf489
raw
history blame
3.65 kB
# **Metrics for Model Performance Monitoring and Validation**
In machine learning, it's essential to evaluate the performance of a model to ensure it's accurate, reliable, and effective. There are various metrics to measure model performance, each with its strengths and limitations. Here's an overview of popular metrics, their pros and cons, and examples of tasks that apply to each.
## **1. Mean Squared Error (MSE)**
MSE measures the average squared difference between predicted and actual values.
Pros:
* Easy to calculate
* Sensitive to outliers
Cons:
* Can be heavily influenced by extreme values
Example tasks:
* Regression tasks, such as predicting house prices or stock prices
* Time series forecasting
## **2. Mean Absolute Error (MAE)**
MAE measures the average absolute difference between predicted and actual values.
Pros:
* Robust to outliers
* Easy to interpret
Cons:
* Can be sensitive to skewness in the data
Example tasks:
* Regression tasks, such as predicting house prices or stock prices
* Time series forecasting
## **3. Mean Absolute Percentage Error (MAPE)**
MAPE measures the average absolute percentage difference between predicted and actual values.
Pros:
* Easy to interpret
* Sensitive to relative errors
Cons:
* Can be sensitive to outliers
Example tasks:
* Regression tasks, such as predicting house prices or stock prices
* Time series forecasting
## **4. R-Squared (R²)**
R² measures the proportion of variance in the dependent variable that's explained by the independent variables.
Pros:
* Easy to interpret
* Sensitive to the strength of the relationship
Cons:
* Can be sensitive to outliers
* Can be misleading for non-linear relationships
Example tasks:
* Regression tasks, such as predicting house prices or stock prices
* Feature selection
## **5. Brier Score**
The Brier Score measures the average squared difference between predicted and actual probabilities.
Pros:
* Sensitive to the quality of the predictions
* Can handle multi-class classification tasks
Cons:
* Can be sensitive to the choice of threshold
Example tasks:
* Multi-class classification tasks, such as image classification
* Multi-label classification tasks
## **6. F1 Score**
The F1 Score measures the harmonic mean of precision and recall.
Pros:
* Sensitive to the balance between precision and recall
* Can handle imbalanced datasets
Cons:
* Can be sensitive to the choice of threshold
Example tasks:
* Binary classification tasks, such as spam detection
* Multi-class classification tasks
## **7. Matthews Correlation Coefficient (MCC)**
MCC measures the correlation between predicted and actual labels.
Pros:
* Sensitive to the quality of the predictions
* Can handle imbalanced datasets
Cons:
* Can be sensitive to the choice of threshold
Example tasks:
* Binary classification tasks, such as spam detection
* Multi-class classification tasks
## **8. Log Loss**
Log Loss measures the average log loss between predicted and actual probabilities.
Pros:
* Sensitive to the quality of the predictions
* Can handle multi-class classification tasks
Cons:
* Can be sensitive to the choice of threshold
Example tasks:
* Multi-class classification tasks, such as image classification
* Multi-label classification tasks
When choosing a metric, consider the specific task, data characteristics, and desired outcome. It's essential to understand the strengths and limitations of each metric to ensure accurate model evaluation.