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._TARGET_MEAN: return ActiveLearningNodeForRegressionMultiTarget( initial_class_observations ) elif self.leaf_prediction == self._PERCEPTRON: return ActiveLearningNodePerceptronMultiTarget( initial_class_observations, parent_node, random_state=self.random_state ) elif self.leaf_prediction == self._ADAPTIVE: new_node = ActiveLearningNodeAdaptiveMultiTarget( 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) return new_node else: if self.leaf_prediction == self._TARGET_MEAN: return InactiveLearningNodeForRegression( initial_class_observations ) elif self.leaf_prediction == self._PERCEPTRON: return InactiveLearningNodePerceptronMultiTarget( initial_class_observations, parent_node, random_state=parent_node.random_state ) elif self.leaf_prediction == self._ADAPTIVE: new_node = InactiveLearningNodeAdaptiveMultiTarget( 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 return new_node
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 == _TARGET_MEAN: return ActiveLearningNodeForRegressionMultiTarget( initial_class_observations) elif self.leaf_prediction == _PERCEPTRON: return ActiveLearningNodePerceptronMultiTarget( initial_class_observations, perceptron_weight, self.random_state) elif self.leaf_prediction == _ADAPTIVE: return ActiveLearningNodeAdaptiveMultiTarget( initial_class_observations, perceptron_weight, random_state=self.random_state)