Jak mapować RDD klasy sprawę do LabeledPoint (etykieta, wektor cech).
Jest to przypadek RDD klasy egzaminu (x: Podwójne, y: Double):
DS (1.0,6.0)
DS (2.0,8.0)
DS (3.0,10.0)
DS (3.0,10.0)
DS (4.0,12.0)
DS (5.0,14.0)
Próbowaliśmy to robić -
val parsedData = aRDD.map(row =>
new LabeledPoint(
row._1,
Vectors.dense(row._2))
Uzyskiwanie błąd „wartość _1 nie jest członkiem main.scala.spark.Q1Partb.Q1.Exam” w row._1 i row._2
i to -
val parsedData = aRDD.map{line =>
val Array(rawLabel, rawfeatures) = line.split(',')
val features = rawfeatures) .split(' ').map(_.toDouble)
LabeledPoint(rawLabel.toDouble, Vectors.dense(features))}
Uzyskiwanie błąd „wartość rekurencyjne x $ 4 dla potrzeb typu” rawLabel i „wartość podziału nie jest członkiem main.scala.spark.Q1Partb.Q1.ds” dla line.split ( „”)