Skip to content

Instantly share code, notes, and snippets.

@dvgodoy
Created July 13, 2020 18:33
Show Gist options
  • Save dvgodoy/df2414bb21640f1133c9b99adb71c952 to your computer and use it in GitHub Desktop.
Save dvgodoy/df2414bb21640f1133c9b99adb71c952 to your computer and use it in GitHub Desktop.
# Shuffles the indices
idx = np.arange(N)
np.random.shuffle(idx)
# Uses first 80 random indices for train
train_idx = idx[:int(N*.8)]
# Uses the remaining indices for validation
val_idx = idx[int(N*.8):]
# Generates train and validation sets
x_train, y_train = x[train_idx], y[train_idx]
x_val, y_val = x[val_idx], y[val_idx]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment