Skip to content

Commit

Permalink
Fix partial fit
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Li <adam2392@gmail.com>
  • Loading branch information
adam2392 committed Sep 9, 2024
1 parent 4551602 commit dd58597
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
10 changes: 1 addition & 9 deletions sklearn/ensemble/_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,15 +1254,7 @@ def partial_fit(self, X, y, sample_weight=None, classes=None):
self : object
Returns the instance itself.
"""
X, y = validate_data(
self,
X,
y,
multi_output=True,
accept_sparse="csc",
dtype=DTYPE,
ensure_all_finite=False,
)
self._validate_params()

# validate input parameters
first_call = _check_partial_fit_first_call(self, classes=classes)
Expand Down
16 changes: 2 additions & 14 deletions sklearn/tree/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1375,15 +1375,7 @@ def partial_fit(self, X, y, sample_weight=None, check_input=True, classes=None):
self : DecisionTreeClassifier
Fitted estimator.
"""
X, y = validate_data(
self,
X,
y,
multi_output=True,
accept_sparse="csc",
dtype=DTYPE,
ensure_all_finite=False,
)
self._validate_params()

# validate input parameters
first_call = _check_partial_fit_first_call(self, classes=classes)
Expand All @@ -1406,11 +1398,7 @@ def partial_fit(self, X, y, sample_weight=None, check_input=True, classes=None):
check_X_params = dict(dtype=DTYPE, accept_sparse="csc")
check_y_params = dict(ensure_2d=False, dtype=None)
X, y = validate_data(
self,
X,
y,
reset=False,
validate_separately=(check_X_params, check_y_params),
self, X, y, reset=False, validate_separately=(check_X_params, check_y_params)
)
if issparse(X):
X.sort_indices()
Expand Down

0 comments on commit dd58597

Please sign in to comment.