Skip to content

Instantly share code, notes, and snippets.

@lettergram
Last active December 31, 2018 05:19
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 lettergram/a37be951dd02a7627da6512b218fbc1f to your computer and use it in GitHub Desktop.
Save lettergram/a37be951dd02a7627da6512b218fbc1f to your computer and use it in GitHub Desktop.
# Generate split training and testing data (80% training, 20% testing)
x_train, x_test, y_train, y_test = load_encoded_data(data_split=0.8)
# Determine the number of categories (i.e. sentence types)
num_classes = np.max(y_train) + 1
# Set the classifcation to a Keras readable format (categorical)
y_train = keras.utils.to_categorical(y_train, num_classes)
y_test = keras.utils.to_categorical(y_test, num_classes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment