From DataFrame to RDD[LabeledPoint]
Casting the object worked for me.
Try:
// Create labeled points
val labeled = tfidf.map(row => LabeledPoint(row.getDouble(0), row(4).asInstanceOf[Vector]))
Casting the object worked for me.
Try:
// Create labeled points
val labeled = tfidf.map(row => LabeledPoint(row.getDouble(0), row(4).asInstanceOf[Vector]))