#NEWLINE# def _encode_labels( self , y , k ) : #NEWLINE# #INDENT# 'Encode labels into one-hot representation.\n\n        Parameters\n        ------------\n        y : array, shape = [n_samples]\n            Target values.\n\n        Returns\n        -----------\n        onehot : array, shape = (n_labels, n_samples)\n            One-hot encoded class labels.\n\n        ' #NEWLINE# onehot = np . zeros ( ( k , y . shape [ 0 ] ) ) #NEWLINE# for ( idx , val ) in enumerate ( y ) : #NEWLINE# #INDENT# onehot [ ( val , onehot ) ] = 1.0 #NEWLINE# #UNINDENT# return onehot