Skip to content

Instantly share code, notes, and snippets.

@ayushoriginal
Created June 24, 2019 06:04
Show Gist options
  • Save ayushoriginal/44847b18534533ae3fc793b7dd77d1e5 to your computer and use it in GitHub Desktop.
Save ayushoriginal/44847b18534533ae3fc793b7dd77d1e5 to your computer and use it in GitHub Desktop.
One hot label
def one_hot(self,labels):
from sklearn.preprocessing import OneHotEncoder
encoder = OneHotEncoder()
return encoder.fit_transform(np.array(labels).reshape(-1,1)).toarray()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment