Skip to content

Instantly share code, notes, and snippets.

@seanbenhur
Created May 19, 2021 07:43
Show Gist options
  • Save seanbenhur/b16f076773f36d5812d6a3975022a630 to your computer and use it in GitHub Desktop.
Save seanbenhur/b16f076773f36d5812d6a3975022a630 to your computer and use it in GitHub Desktop.
# 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