Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spark pipeline vector assembler drop other columns

A spark VectorAssembler http://spark.apache.org/docs/latest/ml-features.html#vectorassembler produces the following output

id | hour | mobile | userFeatures     | clicked | features
----|------|--------|------------------|---------|-----------------------------
 0  | 18   | 1.0    | [0.0, 10.0, 0.5] | 1.0     | [18.0, 1.0, 0.0, 10.0, 0.5]

as you can see the last column contains all the previous features. Is it better / more performant if the other columns are removed e.g. only the label/id and features are retained or is this an unnecessary overhead and just feeding label/id and features into the estimator is enough?

What happens when the VectorAssembler is used in a pipeline? will only the last features be used or will it introduce colinearity (duplicate columns) if the original columns are not removed manually?

like image 457
Georg Heiler Avatar asked Nov 22 '25 09:11

Georg Heiler


1 Answers

Please read carefully the documentation. Every classifier is parametrized by the features column (featuresCol). It doesn't consider any other column or the order of columns.

like image 155
2 revsuser6022341 Avatar answered Nov 24 '25 19:11

2 revsuser6022341



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!