Created
September 27, 2018 15:49
-
-
Save mjbhobe/c30f05beda1001bb306f2a84b83b59d1 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
# shuffle the training dataset (5 times!) | |
for _ in range(5): | |
indexes = np.random.permutation(len(train_data)) | |
train_data = train_data[indexes] | |
train_labels_cat = train_labels_cat[indexes] | |
# now set-aside 10% of the train_data/labels as the | |
# cross-validation sets | |
val_perc = 0.10 | |
val_count = int(val_perc * len(train_data)) | |
# first pick validation set from train_data/labels | |
val_data = train_data[:val_count,:] | |
val_labels_cat = train_labels_cat[:val_count,:] | |
# leave rest in training set | |
train_data2 = train_data[val_count:,:] | |
train_labels_cat2 = train_labels_cat[val_count:,:] | |
# NOTE: We will train on train_data2/train_labels_cat2 and | |
# cross-validate on val_data/val_labels_cat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment