Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2015 07:20 AM
I wound up getting past it with something like:
val assembler = new VectorAssembler() .setInputCols(Array("f1", "f2")) .setOutputCol("features")
val labeled = assembler.transform(df) .select($"price".getItem(1).cast("double"), $"features") .map{case Row(price: Double, features: Vector) => LabeledPoint(price, features)}
which is seems much less verbose (h/t stackoverflow) and directly "promotes" the struct's elements to where I need them.
I also wound up getting past the exceptions (the were, IIRC, match exceptions).
Thanks for the lean-in.