Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16607#discussion_r99263532
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala 
---
    @@ -302,16 +302,36 @@ class Word2VecModel private[ml] (
     @Since("1.6.0")
     object Word2VecModel extends MLReadable[Word2VecModel] {
     
    +  private case class Data(word: String, vector: Array[Float])
    +
       private[Word2VecModel]
       class Word2VecModelWriter(instance: Word2VecModel) extends MLWriter {
     
    -    private case class Data(wordIndex: Map[String, Int], wordVectors: 
Seq[Float])
    -
         override protected def saveImpl(path: String): Unit = {
           DefaultParamsWriter.saveMetadata(instance, path, sc)
    -      val data = Data(instance.wordVectors.wordIndex, 
instance.wordVectors.wordVectors.toSeq)
    +
    +      val wordVectors = instance.wordVectors.getVectors
    +      val dataArray = wordVectors.toSeq.map { case (word, vector) => 
Data(word, vector) }.toArray
    --- End diff --
    
    No need to convert back to an Array


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to