Elffuss BraidHub

kikocis/auto-code-rover public

main · 589 BRawPermalink
1Voting estimator will fail at fit if weights are passed and an estimator is None
2Because we don't check for an estimator to be `None` in `sample_weight` support, `fit` is failing`.
3
4```python
5 X, y = load_iris(return_X_y=True)
6 voter = VotingClassifier(
7 estimators=[('lr', LogisticRegression()),
8 ('rf', RandomForestClassifier())]
9 )
10 voter.fit(X, y, sample_weight=np.ones(y.shape))
11 voter.set_params(lr=None)
12 voter.fit(X, y, sample_weight=np.ones(y.shape))
13```
14
15```
16AttributeError: 'NoneType' object has no attribute 'fit'
17```