koaning / scikit-lego

Extra blocks for scikit-learn pipelines.
https://koaning.github.io/scikit-lego/
MIT License
1.29k stars 118 forks source link

Fix a bug when using models that don't support sample weights #554

Closed Garve closed 1 year ago

Garve commented 1 year ago

Description

Not all classifiers/regressors have a sample weight keyword, e.g. KNN. If you use one of these models, the ZIR will fail. This PR circumvents the problem by checking if the classifier/regressor has a sample_weight as a keyword and only then passes it on. If the classifier or regressor doesn't support sample weights, a warning is logged.

Type of change

@koaning

Garve commented 1 year ago

See https://github.com/koaning/scikit-lego/issues/555 for the failed checks.

Garve commented 1 year ago

Weird, after I merged your current main into my PR, it says 0 files were changed. Is it ok to remove this commit 1307b56 again?

Garve commented 1 year ago

Wow, I'm stupid, this PR got merged already months ago 😅 I thought I forgot it.