Handle Imbalanced Data with SMOTE
Data Preparation & Feature Engineering DS practice problem on Onlearn.
Difficulty: medium.
Topics: Understanding Synthetic Minority Over-sampling Technique (SMOTE) for Class Imbalance, K-Nearest Neighbors interpolation, Synthetic sample generation, Precision-Recall tradeoff, Minority class distribution, Feature space geometry, Statistical Learning, Data Preprocessing, Supervised Learning, Performance Metrics, Model Evaluation, Resampling Techniques, Class Imbalance, Feature Transformation, Data Augmentation, Bias-Variance Tradeoff.
Given a pandas DataFrame containing a binary target column 'target' and several feature columns, implement a function using the imblearn library to apply SMOTE. The function should take the features (X) and target (y) as input, perform the oversampling, and return the resampled feature set and target set as numpy arrays.