Last active
April 21, 2019 16:02
-
-
Save wmlba/b20a44e7d1f86d7cfc3cfeac8a9c77a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imblearn.over_sampling import SMOTE | |
# Resample the minority class. You can change the strategy to 'auto' if you are not sure. | |
sm = SMOTE(sampling_strategy='minority', random_state=7) | |
# Fit the model to generate the data. | |
oversampled_trainX, oversampled_trainY = sm.fit_sample(credit_df.drop('Class', axis=1), credit_df['Class']) | |
oversampled_train = pd.concat([pd.DataFrame(oversampled_trainY), pd.DataFrame(oversampled_trainX)], axis=1) | |
oversampled_train.columns = normalized_df.columns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment