-
-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Description
Currently Pipeline
doesn't support the sample_weight
fit param. It fails with,
ValueError: Pipeline.fit does not accept the sample_weights parameter. You can pass parameters to
specific steps of your pipeline using the stepname__parameter format, e.g.
`Pipeline.fit(X, y, logisticregression__sample_weight=sample_weight)`.
passing the sample weight as logisticregression__sample_weight
is annoying because it's too strongly coupled with the pipeline step names. This means that this code would break if a different estimator is used in the pipeline or else one need to use pipeline steps independent of the estimator used. In any case pipelines constructed with make_pipeline
would break.
I haven't followed the sample props discussion in detail #4497 but is there anything preventing from adding a sample_weight
parameter to the pipeline and doing one of the following?
- either pass it to the last estimator.
- or pass it to all estimators that support sample weights in the pipeline (not sure if there are many transformers with sample weights). Raise an
warningerror if none support it.
The case 1. would already likely address most use cases. Are there drawbacks in doing this?
madhuracj, deadsoul44, suzuki-shm, amueller, antoinecarme and 6 more