You are training a machine learning model to detect credit card fraud, where only 0.1% of the transactions in your dataset are actually fraudulent. Which data-level technique should you use to prevent the model from simply predicting 'not fraud' for every transaction?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal: if 99.9% of your data says 'no fraud' and only 0.1% says 'fraud', your model can get 99.9% accuracy just by being lazy and saying 'no fraud' to everything. Not very helpful for catching bad guys! To fix this, you have to balance the scales. You either duplicate the rare fraud cases (oversampling) or throw out some of the normal transactions (undersampling) so the model actually learns the patterns of both. Trust me, class imbalance is a real-world headache, and resampling is your go-to fix.
Full explanation below image
Full Explanation
Class imbalance occurs when one class (the majority class) vastly outnumbers the other class (the minority class) in a classification dataset. Standard machine learning algorithms are designed to maximize overall accuracy, which bias them heavily toward the majority class. To resolve this at the data level, practitioners use resampling techniques: 1. Oversampling: Increasing the size of the minority class, either by duplicating existing samples or synthetically generating new ones using techniques like SMOTE (Synthetic Minority Over-sampling Technique). 2. Undersampling: Reducing the size of the majority class by randomly or strategically removing samples to balance the class distribution.
To analyze the distractors: - Option B, PCA, is a dimensionality reduction technique used to project high-dimensional data into a lower-dimensional space, which does not address the ratio of class representations. - Option C, gradient descent, is an optimization algorithm used to update model weights to minimize the loss function; adjusting the learning rate doesn't fix the underlying data imbalance. - Option D, k-fold cross-validation, is a validation strategy to assess model generalization but does not modify the class distribution of the training data.
Using resampling helps ensure that the model receives enough signal from the minority class to learn its characteristics and make reliable predictions.