Skip to content

Instantly share code, notes, and snippets.

@rajeshmr
Created December 7, 2017 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajeshmr/852a746b7a76d16068a5bb613085cdce to your computer and use it in GitHub Desktop.
Save rajeshmr/852a746b7a76d16068a5bb613085cdce to your computer and use it in GitHub Desktop.
VALIDATION_SPLIT = 0.4
indices = np.arange(data.shape[0]) # get sequence of row index
np.random.shuffle(indices) # shuffle the row indexes
data = data[indices] # shuffle data/product-titles/x-axis
category = category[indices] # shuffle labels/category/y-axis
nb_validation_samples = int(VALIDATION_SPLIT * data.shape[0])
x_train = data[:-nb_validation_samples]
y_train = category[:-nb_validation_samples]
x_val = data[-nb_validation_samples:]
y_val = category[-nb_validation_samples:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment