Skip to content

Instantly share code, notes, and snippets.

@spidezad
Last active June 28, 2019 03:11
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 spidezad/29ab9555db9238253cc720f33435d94c to your computer and use it in GitHub Desktop.
Save spidezad/29ab9555db9238253cc720f33435d94c to your computer and use it in GitHub Desktop.
One hot Encoding
from keras.utils import np_utils
from sklearn.preprocessing import LabelEncoder
labelenc = LabelEncoder()
y_enc = labelenc.fit_transform(y)
y_onehot = np_utils.to_categorical(y_enc)
y_onehot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment