Skip to content

Instantly share code, notes, and snippets.

@ashokc
Created January 26, 2019 18:06
Show Gist options
  • Save ashokc/0f3fb5b44bba51c110c00086e58acc9b to your computer and use it in GitHub Desktop.
Save ashokc/0f3fb5b44bba51c110c00086e58acc9b to your computer and use it in GitHub Desktop.
Train Test Split
# Test/Train Split
from sklearn.model_selection import StratifiedShuffleSplit
sss = StratifiedShuffleSplit(n_splits=1, test_size=0.2, random_state=1).split(Xencoded, labels)
train_indices, test_indices = next(sss)
train_x, test_x = Xencoded[train_indices], Xencoded[test_indices]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment