You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
In the DecisionTree implementation, line 33 there is a call to the _most_common_label() method.
Line 33 is reached only if the y numpy array has one unique value, so instead of calling most common
you can simply take the value from any index of the array.
Maybe something like:
# check the stopping criteria
if (depth>=self.max_depth or n_labels==1 or n_samples<self.min_samples_split):
return Node(value=y[0])
instead of :
# check the stopping criteria
if (depth>=self.max_depth or n_labels==1 or n_samples<self.min_samples_split):
leaf_value = self._most_common_label(y)
return Node(value=leaf_value)
The text was updated successfully, but these errors were encountered:
Hi,
In the DecisionTree implementation, line 33 there is a call to the _most_common_label() method.
Line 33 is reached only if the y numpy array has one unique value, so instead of calling most common
you can simply take the value from any index of the array.
Maybe something like:
instead of :
The text was updated successfully, but these errors were encountered: