Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created July 17, 2020 12:44
Show Gist options
  • Save prateekjoshi565/a6ba56d3e5f96acd0d7a78c03c106699 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/a6ba56d3e5f96acd0d7a78c03c106699 to your computer and use it in GitHub Desktop.
# split train dataset into train, validation and test sets
train_text, temp_text, train_labels, temp_labels = train_test_split(df['text'], df['label'],
random_state=2018,
test_size=0.3,
stratify=df['label'])
val_text, test_text, val_labels, test_labels = train_test_split(temp_text, temp_labels,
random_state=2018,
test_size=0.5,
stratify=temp_labels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment