Created
January 16, 2021 17:29
-
-
Save AyishaR/7e707d331c607c40f06c947bd63476d9 to your computer and use it in GitHub Desktop.
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
# Splitting into train, val and test set -- 80-10-10 split | |
# First, an 80-20 split | |
train_df, val_test_df = train_test_split(df, test_size = 0.2, random_state = 3) | |
# Then split the 20% into half | |
val_df, test_df = train_test_split(val_test_df, test_size = 0.5, random_state = 3) | |
# Splitting into X (input) and y (output) | |
Xtrain, ytrain = np.array(train_df[input_columns]), np.array(train_df[output_columns]) | |
Xval, yval = np.array(val_df[input_columns]), np.array(val_df[output_columns]) | |
Xtest, ytest = np.array(test_df[input_columns]), np.array(test_df[output_columns]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment