Skip to content

Instantly share code, notes, and snippets.

@rjurney
Created October 17, 2019 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjurney/a789d6f07ff2df9b49f912f6f697b9b9 to your computer and use it in GitHub Desktop.
Save rjurney/a789d6f07ff2df9b49f912f6f697b9b9 to your computer and use it in GitHub Desktop.
How to create a 0.7/0.2/0.1 Train/Test/Dev split of a dataset
from sklearn.model_selection import train_test_split
X_train, X_test_dev, y_train, y_test_dev = train_test_split(
df['_Body'],
df['_Index'],
test_size=0.3,
random_state=1337,
)
X_dev, X_test, y_dev, y_test = train_test_split(
X_test_dev,
y_test_dev,
test_size=0.66667,
random_state=1337,
)
@quocnguyenx43
Copy link

why ramdom state is 1337?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment