Skip to content

Commit

Permalink
Make sure build_tree returns self
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Li <adam2392@gmail.com>
  • Loading branch information
adam2392 committed Feb 22, 2024
1 parent db91ddb commit 4ffa093
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sklearn/tree/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def _fit(
min_weight_leaf = self.min_weight_fraction_leaf * np.sum(sample_weight)

# build the actual tree now with the parameters
self._build_tree(
self = self._build_tree(
X=X,
y=y,
sample_weight=sample_weight,
Expand Down Expand Up @@ -573,6 +573,7 @@ def _build_tree(
self.classes_ = self.classes_[0]

self._prune_tree()
return self

def _validate_X_predict(self, X, check_input):
"""Validate the training data on predict (probabilities)."""
Expand Down

0 comments on commit 4ffa093

Please sign in to comment.