What is the use of transter_weights in a scikit-learn project?

This is just a small question about the scikit-learn pipeline.

In the sklearn.pipeline.FeatureUnion class, the transformer_weights option exists.

transformer_weights: dict, optional
: Multiplicative weights for functions on a transformer. The keys are the names of the transformers, the values โ€‹โ€‹of the weights.

I saw use in an example that gives a different weight to another function.

  transformer_weights={ 'subject': 0.8, 'body_bow': 0.5, 'body_stats': 1.0, }, 

This is nonsense to me, because the classifier will learn to weigh you later. Why use it at all?

+5
source share
1 answer

If you use a linear classifier with a penalty, this will change the size of the penalty applied to each block of functions. Scaling functions will mean that they will be less punished compared to other functions.

+4
source

All Articles