The idea
Change the minority share and watch accuracy, recall, F1, balanced accuracy and the confusion matrix.
Data description
Synthetic data generated in your browser from stated distributions; no real personal data.
Suggested next experiment
Concepts in this experiment
Classification metrics formula
Accuracy, precision, recall, F1 and balanced accuracy.
\mathrm{Acc}=\frac{TP+TN}{n},\;\mathrm{P}=\frac{TP}{TP+FP},\;\mathrm{R}=\frac{TP}{TP+FN},\;F_1=\frac{2PR}{P+R},\;\mathrm{BA}=\frac{\mathrm{TPR}+\mathrm{TNR}}{2}Class imbalance
When one target class is rare, a model can reach high accuracy by predicting the majority class. Use recall, F1, balanced accuracy and the confusion matrix.
Confusion matrix and classification metrics
Four cells: TP, FP, TN, FN; accuracy, precision, recall, F1, specificity and balanced accuracy derive from it. Computing them per group is the basis of fairness measurement.
Scientific sources for this experiment
- imbalanced-learn — SMOTEimbalanced-learn developers (2025) — Tool
