【发布时间】:2018-04-07 19:48:57
【问题描述】:
我正在关注这篇文章:
http://learningfrombigdata.com/semantic-similarity-between-sentences-using-apache-spark/
但是,当我到达这部分时:
def distance(lvec: String, rvec: String): Double = {
val l = DenseVector(lvec.split(',').map(_.toDouble))
val r = DenseVector(rvec.split(',').map(_.toDouble))
math.sqrt(sum((l - r) :* (l - r)))
}
我收到以下错误:
Name: Compile Error
Message: <console>:177: error: org.apache.spark.mllib.linalg.DenseVector.type does not take parameters
val l = DenseVector(lvec.split(',').map(_.toDouble))
^
<console>:178: error: org.apache.spark.mllib.linalg.DenseVector.type does not take parameters
val r = DenseVector(rvec.split(',').map(_.toDouble))
我怀疑它可能与版本有关(我使用的是 Spark 1.6.0),但我不确定,并且无法在网上找到有关此错误的大量信息,不胜感激
【问题讨论】:
标签: scala apache-spark apache-spark-mllib