Skip to main content
AI & ML Bug Hunt Hard +35 XP

Class Imbalance Ignored

Model predicts majority class for almost all inputs.

AI & MLFind the bug
1model = LogisticRegression()
2model.fit(X_train, y_train) # 95% class 0, 5% class 1
The bug is on line 2

Select the correct fix

Show answer and explanation

Answer: Add class_weight='balanced' or use SMOTE

With severe class imbalance, models learn to predict the majority class. Use class_weight='balanced', SMOTE oversampling, or use F1/AUC metrics.

Hint: 95:5 imbalance — the model takes the easy path.

What this challenge tests

Bug Hunt in AI & ML: class-imbalance, sampling.

Related challenges