Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dac3723

Browse files
committed
Pass sample_weight as kwarg in VotingClassifier
1 parent c1eee27 commit dac3723

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sklearn/ensemble/voting_classifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
from ..utils.metaestimators import _BaseComposition
2424

2525

26-
def _parallel_fit_estimator(estimator, X, y, sample_weight):
26+
def _parallel_fit_estimator(estimator, X, y, sample_weight=None):
2727
"""Private function used to fit an estimator within a job."""
2828
if sample_weight is not None:
29-
estimator.fit(X, y, sample_weight)
29+
estimator.fit(X, y, sample_weight=sample_weight)
3030
else:
3131
estimator.fit(X, y)
3232
return estimator
@@ -185,7 +185,7 @@ def fit(self, X, y, sample_weight=None):
185185

186186
self.estimators_ = Parallel(n_jobs=self.n_jobs)(
187187
delayed(_parallel_fit_estimator)(clone(clf), X, transformed_y,
188-
sample_weight)
188+
sample_weight=sample_weight)
189189
for clf in clfs if clf is not None)
190190

191191
return self

0 commit comments

Comments
 (0)