Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code clean up
  • Loading branch information
yanboliang committed Nov 19, 2015
commit de3822efd896233313d23144a6f3fb08c380932b
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ object Word2VecModel extends MLReadable[Word2VecModel] {

override protected def saveImpl(path: String): Unit = {
DefaultParamsWriter.saveMetadata(instance, path, sc)
val data = Data(instance.wordVectors.wordIndex, instance.wordVectors.wordVectors)
val data = Data(instance.wordVectors.wordIndex, instance.wordVectors.wordVectors.toSeq)
val dataPath = new Path(path, "data").toString
sqlContext.createDataFrame(Seq(data)).repartition(1).write.parquet(dataPath)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import scala.beans.{BeanInfo, BeanProperty}
import org.apache.spark.{Logging, SparkException, SparkFunSuite}
import org.apache.spark.ml.attribute._
import org.apache.spark.ml.param.ParamsSuite
import org.apache.spark.ml.util.{MLTestingUtils, DefaultReadWriteTest}
import org.apache.spark.ml.util.{DefaultReadWriteTest, MLTestingUtils}
import org.apache.spark.mllib.linalg.{SparseVector, Vector, Vectors}
import org.apache.spark.mllib.util.MLlibTestSparkContext
import org.apache.spark.rdd.RDD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ class Word2VecSuite extends SparkFunSuite with MLlibTestSparkContext with Defaul
val t = new Word2Vec()
.setInputCol("myInputCol")
.setOutputCol("myOutputCol")
.setMaxIter(5)
.setMinCount(10)
.setNumPartitions(2)
.setMaxIter(2)
.setMinCount(8)
.setNumPartitions(1)
.setSeed(42L)
.setStepSize(0.015)
.setVectorSize(200)
.setStepSize(0.01)
.setVectorSize(100)
testDefaultReadWrite(t)
}

Expand Down