Skip to content

Commit eccefcc

Browse files
committed
minor updates to word2vec
1 parent 7eb9cbc commit eccefcc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import org.apache.spark.SparkContext._
3030
import org.apache.spark.annotation.Experimental
3131
import org.apache.spark.api.java.JavaRDD
3232
import org.apache.spark.mllib.linalg.{Vector, Vectors}
33-
import org.apache.spark.mllib.rdd.RDDFunctions._
3433
import org.apache.spark.rdd._
3534
import org.apache.spark.util.Utils
3635
import org.apache.spark.util.random.XORShiftRandom
@@ -285,9 +284,9 @@ class Word2Vec extends Serializable with Logging {
285284

286285
val newSentences = sentences.repartition(numPartitions).cache()
287286
val initRandom = new XORShiftRandom(seed)
288-
var syn0Global =
287+
val syn0Global =
289288
Array.fill[Float](vocabSize * vectorSize)((initRandom.nextFloat() - 0.5f) / vectorSize)
290-
var syn1Global = new Array[Float](vocabSize * vectorSize)
289+
val syn1Global = new Array[Float](vocabSize * vectorSize)
291290
var alpha = startingAlpha
292291
for (k <- 1 to numIterations) {
293292
val partial = newSentences.mapPartitionsWithIndex { case (idx, iter) =>

0 commit comments

Comments
 (0)