Я пытаюсь добавить featureD
в виде массива Double в Vectors.dense
функцию, но получаю эту ошибку:
templates/scala-parallel-classification/reading-custom-properties/src/main/scala/DataSource.scala:58:21: overloaded method value dense with alternatives:
[INFO] [Engine$] [error] (values: Array[Double])org.apache.spark.mllib.linalg.Vector <and>
[INFO] [Engine$] [error] (firstValue: Double,otherValues: Double*)org.apache.spark.mllib.linalg.Vector
[INFO] [Engine$] [error] cannot be applied to (Array[Any])
[INFO] [Engine$] [error] Vectors.dense(Array(
Это мой код:
required = Some(List( // MODIFIED
"featureA", "featureB", "featureC", "featureD", "label")))(sc)
// aggregateProperties() returns RDD pair of
// entity ID and its aggregated properties
.map { case (entityId, properties) =>
try {
// MODIFIED
LabeledPoint(properties.get[Double]("label"),
Vectors.dense(Array(
properties.get[Double]("featureA"),
properties.get[Double]("featureB"),
properties.get[Double]("featureC"),
properties.get[Array[Double]]("featureD")
))
)
} catch {
case e: Exception => {
logger.error(s"Failed to get properties ${properties} of" +
s" ${entityId}. Exception: ${e}.")
throw e
}
}
Как передать массив в массив функции Vectors.dense
?