Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _calculate_split_score(self, split):
"""Calculate the score of the split.
score = current_error - after_split_error
"""
left_error = gini(split['left'])
right_error = gini(split['right'])
error = gini(self.Y)
# if the split is any good, the score should be greater than 0
total = float(len(self.Y))
score = (error - 1 / total * (len(split['left']) * left_error +
len(split['right']) * right_error))
return score
def _calculate_split_score(self, split):
"""Calculate the score of the split.
score = current_error - after_split_error
"""
left_error = gini(split['left'])
right_error = gini(split['right'])
error = gini(self.Y)
# if the split is any good, the score should be greater than 0
total = float(len(self.Y))
score = (error - 1 / total * (len(split['left']) * left_error +
len(split['right']) * right_error))
return score
def _calculate_split_score(self, split):
"""Calculate the score of the split.
score = current_error - after_split_error
"""
left_error = gini(split['left'])
right_error = gini(split['right'])
error = gini(self.Y)
# if the split is any good, the score should be greater than 0
total = float(len(self.Y))
score = (error - 1 / total * (len(split['left']) * left_error +
len(split['right']) * right_error))
return score