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
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)
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
def clear_weights(self): self.lgbm = lgb.LGBMClassifier() self._one_hot_encoder = utils.OneHotEncoder() self._output_shape = None
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()
def __init__(self, **kwargs): super().__init__(**kwargs) self.lgbm = lgb.LGBMClassifier() self._one_hot_encoder = utils.OneHotEncoder()