scala - HashingTF not found while trying to compile sample tfidf code for apache spark -
scala - HashingTF not found while trying to compile sample tfidf code for apache spark -
import org.apache.spark.rdd.rdd import org.apache.spark.sparkcontext import org.apache.spark.mllib.feature.hashingtf import org.apache.spark.mllib.linalg.vector val sc: sparkcontext = ... // load documents (one per line). val documents: rdd[seq[string]] = sc.textfile("...").map(_.split(" ").toseq) val hashingtf = new hashingtf() val tf: rdd[vector] = hashingtf.transform(documents)
while trying compile above code snippet, next errors
[error] /siva/test/src/main/scala/com/chimpler/sparknaivebayesreuters/tokenizer.scala:10: object feature not fellow member of bundle org.apache.spark.mllib [error] import org.apache.spark.mllib.feature.hashingtf [error] ^ [error] /siva/test/src/main/scala/com/chimpler/sparknaivebayesreuters/tokenizer.scala:36: not found: type hashingtf [error] val hashingtf = new hashingtf() [error] ^ [error] /siva/test/src/main/scala/com/chimpler/sparknaivebayesreuters/tokenizer.scala:37: not found: value hasingtf [error] val tf: rdd[vector] = hasingtf.transform(documents) [error] ^ [error] 3 errors found [error] (compile:compile) compilation failed [error] total time: 14 s, completed 3 nov, 2014 1:57:31 pm
i have added next lines in build.sbt file.
librarydependencies ++= seq( "org.apache.spark" %% "spark-core" % "1.0.2" % "provided", "org.apache.spark" %% "spark-mllib" % "1.0.2" % "provided") // "org.apache.spark" %% "spark-streaming" % "1.0.0" % "provided")
any pointers?
i using wrong version of mllib . modifying librarydependencies spark-mllib 1.1.0 fixed it.
scala apache-spark mllib
Comments
Post a Comment