Created
June 16, 2020 23:46
-
-
Save Mehdi-Amine/300cfd42eea60a99ab8655aedded25fb to your computer and use it in GitHub Desktop.
splitting dataset into train, valid and test sets
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.model_selection import train_test_split | |
data = np.copy(tib) | |
train_set, test_set = train_test_split(data, test_size=0.3, random_state=42) | |
train_set, valid_set = train_test_split(train_set, test_size=0.2, random_state=42) | |
# printing the shapes of the datasets | |
train_set.shape, valid_set.shape, test_set.shape | |
''' | |
Out: | |
((3360, 4), (840, 4), (1800, 4)) | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment