dictionary - how to print Map[String, Array[Float]] in scala? -


i using word2vec function inside mllib library of spark. want print word vectors getting output "getvectors" function code looks this:

import org.apache.spark._  import org.apache.spark.rdd._ import org.apache.spark.sparkcontext._ import org.apache.spark.mllib.feature.{word2vec, word2vecmodel}  object word2vec {   def main(args: array[string]) {     val conf = new sparkconf().setappname("word2vec")     val sc = new sparkcontext(conf)     val input = sc.textfile("file:///home/snap-01/balance.csv").map(line => line.split(",").toseq)     val word2vec = new word2vec()     val model = word2vec.fit(input)     model.save(sc, "mymodelpath")     val samemodel = word2vecmodel.load(sc, "mymodelpath")     val vec = samemodel.getvectors     print(vec)   } } 

i getting "map(balance -> [f@2932e15f)"

try :

vec.foreach { case (key, values) => println("key " + key + " - " + values.mkstring("-")  } 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -