Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _apply_best_split(self):
best_split, best_split_score = self._find_best_split()
if best_split_score > 0:
self.criterion = lambda x: x[best_split['feature']] \
> best_split['value']
# create the left child
self.left = ClassificationTree(
number_of_features=self.number_of_features,
number_of_functions=self.number_of_functions,
min_sample_split=self.min_sample_split,
predict_initialize={
'count_dict': count_dict(best_split['left']),
}
)
# create the right child
self.right = ClassificationTree(
number_of_features=self.number_of_features,
number_of_functions=self.number_of_functions,
min_sample_split=self.min_sample_split,
predict_initialize={
'count_dict': count_dict(best_split['right']),
}
)
# Collect garbage
self.samples = {}
self.Y = []
def _apply_best_split(self):
best_split, best_split_score = self._find_best_split()
if best_split_score > 0:
self.criterion = lambda x: x[best_split['feature']] \
> best_split['value']
# create the left child
self.left = ClassificationTree(
number_of_features=self.number_of_features,
number_of_functions=self.number_of_functions,
min_sample_split=self.min_sample_split,
predict_initialize={
'count_dict': count_dict(best_split['left']),
}
)
# create the right child
self.right = ClassificationTree(
number_of_features=self.number_of_features,
number_of_functions=self.number_of_functions,
min_sample_split=self.min_sample_split,
predict_initialize={
'count_dict': count_dict(best_split['right']),
}
)