Пример #1
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.data = []
     self.label = []
     self.lgbm = lgb.LGBMClassifier()
     self._one_hot_encoder = utils.OneHotEncoder()
     self.y_shape = None
Пример #2
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)
Пример #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
Пример #4
0
 def clear_weights(self):
     self.lgbm = lgb.LGBMClassifier()
     self._one_hot_encoder = utils.OneHotEncoder()
     self._output_shape = None
Пример #5
0
 def __init__(self, seed=None, **kwargs):
     super().__init__(seed=seed, **kwargs)
     self.lgbm = lgb.LGBMClassifier(random_state=self.seed)
     self._one_hot_encoder = utils.OneHotEncoder()
Пример #6
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.lgbm = lgb.LGBMClassifier()
     self._one_hot_encoder = utils.OneHotEncoder()