Skip to content

Instantly share code, notes, and snippets.

@seanbenhur
Created May 19, 2021 08:52
Show Gist options
  • Save seanbenhur/bd896800776d399a02d973f208aa88a8 to your computer and use it in GitHub Desktop.
Save seanbenhur/bd896800776d399a02d973f208aa88a8 to your computer and use it in GitHub Desktop.
from reg_resampler import resampler
# Initialize the resampler object
rs = resampler()
# You might recieve info about class merger for low sample classes
# Generate classes
Y_classes = rs.fit(train, target=target, bins=num_bins)
# Create the actual target variable
Y = df_train[target]
# Create a smote (over-sampling) object from imblearn
smote = SMOTE(random_state=27)
# Now resample
final_X, final_Y = rs.resample(smote, df_train, Y_classes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment