Skip to content

Instantly share code, notes, and snippets.

@FelixChop
Last active April 2, 2020 12:31
Show Gist options
  • Save FelixChop/3ffa60e0d9847d45ed7439e2a1c3c9e0 to your computer and use it in GitHub Desktop.
Save FelixChop/3ffa60e0d9847d45ed7439e2a1c3c9e0 to your computer and use it in GitHub Desktop.
from sklearn.model_selection import train_test_split
target = 'Survived'
intermediate_sample, holdout = train_test_split(titanic,
test_size=.2,
random_state=2020,
stratify=titanic[target])
train, validation = train_test_split(intermediate_sample,
test_size=.2,
random_state=2020,
stratify=intermediate_sample[target])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment