docstr: Transform labels to one-hot encodings.
  
  # Arguments
      dataset: tf.data.Dataset. The dataset to be transformed.
  
  # Returns
      tf.data.Dataset. The transformed dataset.
docstr_tok: ["Transform","labels","to","one-hot","encodings",".","#","Arguments","dataset",":","tf.data.Dataset",".","The","dataset","to","be","transformed",".","#","Returns","tf.data.Dataset",".","The","transformed","dataset","."]
code: def transform(self, dataset):
      """Transform labels to one-hot encodings.
  
      # Arguments
          dataset: tf.data.Dataset. The dataset to be transformed.
  
      # Returns
          tf.data.Dataset. The transformed dataset.
      """
      dataset = super().transform(dataset)
      eye = tf.eye(len(self.labels))
      dataset = dataset.map(lambda x: tf.nn.embedding_lookup(eye, x))
      return dataset
  
file_path: autokeras/autokeras/preprocessors/encoders.py
imports: import numpy
  import tensorflow
  from autokeras.engine import preprocessor
label_desc: Use image node_id 1 for calling the OneHotEncoder obj's underlying member method code with example usage: obj.transform(dataset) and returns: dataset