Created
June 12, 2019 00:00
-
-
Save ashunigion/c820c4a85439fd41bb0dd10c5b0a0772 to your computer and use it in GitHub Desktop.
Train, test, validation split
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.cross_validation import train_test_split | |
split_frac = 0.8 | |
## split data into training, validation, and test data (features and labels, x and y) | |
train_x,test_x,train_y,test_y = train_test_split(features, encoded_labels, test_size = 0.2) | |
test_x,valid_x,test_y,valid_y = train_test_split(test_x,test_y, test_size = 0.5) | |
## print out the shapes of your resultant feature data | |
print((train_x.shape), (test_x.shape), (valid_x.shape)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment