It's just a little question of scikit-learn's pipeline.
In the class sklearn.pipeline.FeatureUnion
, there is a transformer_weights
option .
transformer_weights: dict, optional
: Multiplicative weights for features per transformer. Keys are transformer names, values the weights.
I saw the use in an example that give different weight to different feature.
transformer_weights={
'subject': 0.8,
'body_bow': 0.5,
'body_stats': 1.0,
},
It's nonsense to me, because the classifier will learn the weighting for you later. Why bother using it at all?
If you use a linear classifier with penalty, this will change the amount of penalty applied to each block of features. Scaling features up will mean they will be less penalized relative to the other features.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With