Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX correct node splitting order & remove class weight #56

Merged
merged 7 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions sklearn/ensemble/_forest.py
PSSF23 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -1252,17 +1252,6 @@ def partial_fit(self, X, y, sample_weight=None, classes=None):

self.n_outputs_ = y.shape[1]

y, expanded_class_weight = self._validate_y_class_weight(y)

if getattr(y, "dtype", None) != DOUBLE or not y.flags.contiguous:
y = np.ascontiguousarray(y, dtype=DOUBLE)

if expanded_class_weight is not None:
if sample_weight is not None:
sample_weight = sample_weight * expanded_class_weight
else:
sample_weight = expanded_class_weight

if not self.bootstrap and self.max_samples is not None:
raise ValueError(
"`max_sample` cannot be set if `bootstrap=False`. "
Expand Down Expand Up @@ -1367,10 +1356,6 @@ def partial_fit(self, X, y, sample_weight=None, classes=None):
else:
self._set_oob_score_and_attributes(X, y)

# Decapsulate classes_ attributes
if hasattr(self, "classes_") and self.n_outputs_ == 1:
self.n_classes_ = self.n_classes_[0]
self.classes_ = self.classes_[0]
return self

def predict(self, X):
Expand Down
2 changes: 1 addition & 1 deletion sklearn/tree/_tree.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ cdef class DepthFirstTreeBuilder(TreeBuilder):

if not first:
# push reached leaf nodes onto stack
for key, value in reversed(sorted(self.initial_roots.items())):
for key, value in sorted(self.initial_roots.items()):
end += value[0]
update_stack.push({
"start": start,
Expand Down
Loading