Ejemplo n.º 1
0
 def fit(self, y):
     if not isinstance(y, np.ndarray):
         return
     if not utils.is_label(y):
         return
     self.label_encoder = utils.OneHotEncoder()
     self.label_encoder.fit_with_labels(y)
Ejemplo n.º 2
0
 def _label_encoding(self, y):
     self._label_encoders = []
     new_y = []
     for temp_y, output_node in zip(y, self.outputs):
         head = output_node
         if isinstance(head, hyper_node.Node):
             head = output_node.in_hypermodels[0]
         if (isinstance(head, hyper_head.ClassificationHead)
                 and utils.is_label(temp_y)):
             label_encoder = processor.OneHotEncoder()
             label_encoder.fit(y)
             new_y.append(label_encoder.transform(y))
             self._label_encoders.append(label_encoder)
         else:
             new_y.append(temp_y)
             self._label_encoders.append(None)
     return new_y
Ejemplo n.º 3
0
 def _label_encoding(self, y):
     self._label_encoders = []
     new_y = []
     for temp_y, output_node in zip(y, self.outputs):
         hyper_head = output_node
         if isinstance(hyper_head, node.Node):
             hyper_head = output_node.in_blocks[0]
         if (isinstance(hyper_head, head.ClassificationHead)
                 and utils.is_label(temp_y)):
             label_encoder = utils.OneHotEncoder()
             label_encoder.fit_with_labels(y)
             new_y.append(label_encoder.encode(y))
             self._label_encoders.append(label_encoder)
         else:
             new_y.append(temp_y)
             self._label_encoders.append(None)
     return new_y