Created
January 6, 2020 10:16
-
-
Save AllanLRH/b453749aff0bdd8d1d8346299d0d808e to your computer and use it in GitHub Desktop.
#resample #train_test_split
This file contains 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
import imblearn | |
from sklearn import model_selection | |
rus = imblearn.under_sampling.RandomUnderSampler(sampling_strategy=1.0, random_state=42) | |
X, y = rus.fit_sample(df.drop('Target', axis=1), df.Target) | |
X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=0.33, random_state=42) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment