Skip to content
Middle+0 views

You have a binary classification dataset with 5,000 examples of the first class and 95,000 of the second. What would you do?

Practice

Asked at

AI answer

First, I would determine how important the rare class is and what the cost of errors is: false negatives and false positives. Then I would split the data into train/validation/test sets using stratification and check for leakage; I would not use the test set to select a solution. I would compare a baseline model with models trained using class weights or sampling (for example, oversampling only on the train set). I would evaluate performance using more than just accuracy: precision, recall, F1, and PR-AUC for the rare class. If needed, I would select a threshold on the validation set based on the required trade-off. If probabilities matter, I would check their calibration. After deployment, I would monitor performance and the share of positive predictions.