A data scientist is building a fraud detection model using a transaction dataset containing ten million records. However, only 0.05% of the transactions are flagged as fraudulent. If the model is trained on this data as-is, it will likely achieve high accuracy simply by classifying every transaction as legitimate. Which preprocessing strategy should the scientist apply to prevent this bias and ensure the model accurately learns the characteristics of fraudulent transactions?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal: if you have a dataset where 99.95% of the data is one class (legitimate transactions) and only 0.05% is the other (fraud), your machine learning model is going to get lazy. It'll just guess "legitimate" every single time, hit 99.95% accuracy, and go home. That is a useless model! To force the model to actually learn what fraud looks like, you have to balance the scales. Oversampling the minority class—using techniques like SMOTE—synthesizes new fraud records so the model gets enough exposure to both classes. Don't fall for the "high accuracy" trap on imbalanced data!
Full explanation below image
Full Explanation
Class imbalance is a pervasive challenge in classification tasks such as fraud detection, medical diagnosis, and cybersecurity. When one class vastly outnumbers the other (e.g., 99.95% legitimate vs. 0.05% fraudulent), a standard machine learning algorithm will optimize for the majority class, as it minimizes the loss function most easily. Consequently, the model exhibits strong bias, failing to recognize the rare minority events. To solve this, data preprocessing techniques are used to balance the dataset. Oversampling the minority class—specifically using techniques like Synthetic Minority Over-sampling Technique (SMOTE)—creates synthetic examples of the minority class by interpolating between existing minority samples. This provides the model with sufficient representation of the rare class, enabling it to learn the distinguishing boundaries between classes. Let's review the incorrect options. Option A (discarding minority data) makes it impossible to build a fraud classifier, as the model will never see examples of fraud. Option B (evaluating using overall classification accuracy) does not solve the underlying bias and uses a highly misleading metric. In highly imbalanced datasets, metrics like Precision, Recall, F1-score, and Area Under the Precision-Recall Curve (AUPRC) must be used. Option C (using PCA while excluding the minority class) is counterproductive. PCA reduces dimensionality but does not address class imbalance. Excluding the minority class from feature reduction ensures that the model loses the features critical for distinguishing fraudulent transactions.