Skip to content

Instantly share code, notes, and snippets.


amankharwal/ Secret

Created Apr 25, 2021
What would you like to do?
# Resampling with Replacement
import numpy as np
from sklearn.utils import resample
x_resampled = resample(x[y==1], n_samples=x[y==0].shape[0], random_state=1000)
x_ = np.concatenate((x[y==0], x_resampled))
y_ = np.concatenate((y[y==0], np.ones(shape=(x[y==0].shape[0],), dtype=np.int32)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment