def _new_learning_node(self, initial_class_observations=None, perceptron_weight=None): """Create a new learning node. The type of learning node depends on the tree configuration. """ if initial_class_observations is None: initial_class_observations = {} if self.leaf_prediction == _PERCEPTRON: return SSTActiveLearningNode(initial_class_observations, perceptron_weight, self.random_state) elif self.leaf_prediction == _ADAPTIVE: return SSTActiveLearningNodeAdaptive( initial_class_observations, perceptron_weight, random_state=self.random_state)
def _new_learning_node(self, initial_class_observations=None, parent_node=None, is_active_node=True): """Create a new learning node. The type of learning node depends on the tree configuration. """ if initial_class_observations is None: initial_class_observations = {} if is_active_node: if self.leaf_prediction == self._PERCEPTRON: return SSTActiveLearningNode(initial_class_observations, parent_node, random_state=self.random_state) elif self.leaf_prediction == self._ADAPTIVE: new_node = SSTActiveLearningNodeAdaptive( initial_class_observations, parent_node, random_state=self.random_state) # Resets faded errors new_node.fMAE_M = np.zeros(self._n_targets, dtype=np.float64) new_node.fMAE_P = np.zeros(self._n_targets, dtype=np.float64) new_node.fMAE_SP = np.zeros(self._n_targets, dtype=np.float64) return new_node else: if self.leaf_prediction == self._PERCEPTRON: return SSTInactiveLearningNode( initial_class_observations, parent_node, random_state=parent_node.random_state) elif self.leaf_prediction == self._ADAPTIVE: new_node = SSTInactiveLearningNodeAdaptive( initial_class_observations, parent_node, random_state=parent_node.random_state) new_node.fMAE_M = parent_node.fMAE_M new_node.fMAE_P = parent_node.fMAE_P new_node.fMAE_SP = parent_node.fMAE_SP return new_node