Created
May 19, 2021 07:43
-
-
Save seanbenhur/b16f076773f36d5812d6a3975022a630 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# printing the number of samples before smote | |
print('majority class: %d' % np.sum(y == 0)) | |
print('minority class: %d' % np.sum(y == 1)) | |
#majority class: 100 | |
#minority class: 50 | |
#The oversampling is carried out by instantiating any oversampler implemented in the package and calling the sample function. | |
oversampler= sv.distance_SMOTE() | |
X_samp, y_samp= oversampler.sample(X, y) | |
# printing the number of samples | |
print('majority class: %d' % np.sum(y_samp == 0)) | |
print('minority class: %d' % np.sum(y_samp == 1)) | |
#majority class: 100 | |
#minority class: 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment