Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Aug 19, 2020
Embed
What would you like to do?
from sklearn.utils import resample
train_majority = train_clean[train_clean.label==0]
train_minority = train_clean[train_clean.label==1]
train_minority_upsampled = resample(train_minority,
replace=True,
n_samples=len(train_majority),
random_state=123)
train_upsampled = pd.concat([train_minority_upsampled, train_majority])
train_upsampled['label'].value_counts()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment