Commit 2a7fc7fc authored by 高雅喆's avatar 高雅喆

add log

parent db865d0f
...@@ -167,11 +167,12 @@ object Main { ...@@ -167,11 +167,12 @@ object Main {
(word1, word2, entry.value) (word1, word2, entry.value)
} }
// remapSecond.take(20).foreach(println) remapSecond.take(20).foreach(println)
val score_result = remapSecond.toDF("cid1","cid2","score") val score_result = remapSecond.toDF("cid1","cid2","score")
GmeiConfig.writeToJDBCTable(score_result, table="nd_cid_pairs_cosine_distince", SaveMode.Overwrite) GmeiConfig.writeToJDBCTable(score_result, table="nd_cid_pairs_cosine_distince", SaveMode.Overwrite)
println("done1")
// group by neighbours to get a list of similar words and then take top k // group by neighbours to get a list of similar words and then take top k
val result = remapSecond.groupBy(_._1).map { val result = remapSecond.groupBy(_._1).map {
...@@ -180,10 +181,12 @@ object Main { ...@@ -180,10 +181,12 @@ object Main {
val similar = similarWords.toSeq.sortBy(-1 * _._3).filter(_._2.startsWith("diary")).take(10).map(_._2).mkString(",") val similar = similarWords.toSeq.sortBy(-1 * _._3).filter(_._2.startsWith("diary")).take(10).map(_._2).mkString(",")
(word1,s"$similar") (word1,s"$similar")
} }
// result.take(20).foreach(println) result.take(20).foreach(println)
val similar_result = result.toDF("cid","similarity_cid") val similar_result = result.toDF("cid","similarity_cid")
GmeiConfig.writeToJDBCTable(similar_result, table="nd_cid_similarity_matrix", SaveMode.Overwrite) GmeiConfig.writeToJDBCTable(similar_result, table="nd_cid_similarity_matrix", SaveMode.Overwrite)
println("done2")
//3. cids queue map to device_id //3. cids queue map to device_id
...@@ -213,6 +216,8 @@ object Main { ...@@ -213,6 +216,8 @@ object Main {
device_queue.take(20).foreach(println) device_queue.take(20).foreach(println)
GmeiConfig.writeToJDBCTable(device_queue, table="nd_device_cid_similarity_matrix", SaveMode.Overwrite) GmeiConfig.writeToJDBCTable(device_queue, table="nd_device_cid_similarity_matrix", SaveMode.Overwrite)
println("done3")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment