You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow sample_weights in SplineTransformer.fit method #20522
Sample weights are central in many applications (e.g. risk modelling in insurance). The missing support for sample weights prohibits the use of the SplineTransformer with knots="quantile" in these applications. Implementing this would be a minor change, making a slight adjustment to SplineTransformer._get_base_knot_positions. Thus IMO the benefit of wider usage would outweigh the slight increase in complexity.
There is a precedent for using sample weights in transformers' fit methods, see e.g. the Normalizer.
To benefit fully from sample weights, it'd also be ideal for the column transformer passed fit parameters to the transformers, which isn't the case at present (unlike the pipeline), though that's a separate issue.
I see the use case for having sample_weight support in SplineTransformer. I also think, that applying the sample weights to the quantiles as weighted quantiles is the right behavior as "weighted splines" don't make sense to me.
I wonder why QuantileTransformer and KBinsDiscretizer(strategy="quantile") don't support sample_weight.
Activity
lbittarello commentedon Jul 13, 2021
To benefit fully from sample weights, it'd also be ideal for the column transformer passed fit parameters to the transformers, which isn't the case at present (unlike the pipeline), though that's a separate issue.
lorentzenchr commentedon Jul 14, 2021
I see the use case for having
sample_weightsupport inSplineTransformer. I also think, that applying the sample weights to the quantiles as weighted quantiles is the right behavior as "weighted splines" don't make sense to me.I wonder why
QuantileTransformerandKBinsDiscretizer(strategy="quantile")don't supportsample_weight.mlondschien commentedon Jul 19, 2021
Thanks @lorentzenchr. In that case, could you have a look at #20526 and #20528?
glemaitre commentedon Jul 21, 2021
I think that they are only missing features :)