code: def _one_hot(self, y, n_labels, dtype):
      """Returns a matrix where each sample in y is represented
         as a row, and each column represents the class label in
         the one-hot encoding scheme.
  
      Example:
  
          y = np.array([0, 1, 2, 3, 4, 2])
          mc = _BaseMultiClass()
          mc._one_hot(y=y, n_labels=5, dtype='float')
  
          np.array([[1., 0., 0., 0., 0.],
                    [0., 1., 0., 0., 0.],
                    [0., 0., 1., 0., 0.],
                    [0., 0., 0., 1., 0.],
                    [0., 0., 0., 0., 1.],
                    [0., 0., 1., 0., 0.]])
  
      """
      mat = np.zeros((len(y), n_labels))
      for i, val in enumerate(y):
          mat[i, val] = 1
      return mat.astype(dtype)
  
imports: import numpy
label_desc: Use image node_id 2 for calling the _MultiClass obj's underlying member method code with example usage: obj._one_hot(y, n_labels, dtype) and returns: mat