Skip to content

Instantly share code, notes, and snippets.

@nphausg
Last active July 25, 2021 15:30
Show Gist options
  • Select an option

  • Save nphausg/926dc192b3a80b5b74b7099c3f39800b to your computer and use it in GitHub Desktop.

Select an option

Save nphausg/926dc192b3a80b5b74b7099c3f39800b to your computer and use it in GitHub Desktop.
random_state[sklearn].py
>>> x_train, x_test, y_train, y_test = train_test_split(
... x, y, test_size=4, random_state=4
... )
>>> x_train
array([[17, 18],
[ 5, 6],
[23, 24],
[ 1, 2],
[ 3, 4],
[11, 12],
[15, 16],
[21, 22]])
>>> x_test
array([[ 7, 8],
[ 9, 10],
[13, 14],
[19, 20]])
>>> y_train
array([1, 1, 0, 0, 1, 0, 1, 1])
>>> y_test
array([0, 1, 0, 0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment