Created
June 24, 2019 06:04
-
-
Save ayushoriginal/44847b18534533ae3fc793b7dd77d1e5 to your computer and use it in GitHub Desktop.
One hot label
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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