Commit 831ea5f937f57cd26271630596c78a16760873f1

Authored by Joanne ago
1 parent f815d04efe
Exists in master

param and maxvalue change

Showing 1 changed file with 5 additions and 4 deletions Side-by-side Diff

app/com/piki_ds/ver1/EditorScore.scala View file @ 831ea5f
1 1 package com.piki_ds.ver1
2 2  
3   -import breeze.linalg.min
  3 +//import breeze.linalg.min
4 4 import org.apache.spark.rdd.RDD
5 5 import org.apache.hadoop.fs.{Path, FileStatus, FileSystem}
6 6 import org.apache.spark.sql.SQLContext
... ... @@ -67,7 +67,7 @@
67 67 val user_info: RDD[(String, String)] = user_tableGet.map(x=>(x.getAs[Long]("uid").toString, x.getAs[String]("name")))
68 68  
69 69 // DB에서 FOLLOW table 파싱해오기, 팔로워 수 가져오기
70   - val follow_info: RDD[(String, Long)] = followGetter(sQLContext, dateKey,false)
  70 + val follow_info: RDD[(String, Long)] = followGetter(sQLContext, dateKey)
71 71  
72 72 val joinedFollowInfo: RDD[(String, (String, Long))] = user_info.leftOuterJoin(follow_info).map(x=>(x._1,(x._2._1,x._2._2.getOrElse(10L))))
73 73  
74 74  
... ... @@ -80,9 +80,10 @@
80 80 val debut_info: RDD[(String, Long)] = mgcont_table.map(x=>(x.getAs[Long]("uid").toString, x.getAs[Long]("unixtimestamp(min(udate),yyyy-MM-dd HH:mm:ss)")))
81 81  
82 82 // uid, name, follow, debut
83   - joinedFollowInfo.leftOuterJoin(debut_info).map(x=>{
  83 + val rawOut: RDD[(String, String, Long, Long)] = joinedFollowInfo.leftOuterJoin(debut_info).map(x=>{
84 84 (x._1,(x._2._1 ,x._2._2.getOrElse(10L)))
85 85 }).map(x=>(x._1,x._2._1._1, x._2._1._2, x._2._2))
  86 + rawOut.map(x=>(x._1,x._2, math.min(20000,x._3),x._4))
86 87 }
87 88  
88 89 def popularity(dBTable: RDD[(String, String, Long, Long)], currentTS:Long) = {
... ... @@ -160,7 +161,7 @@
160 161 */
161 162 val finalScore = ePopularity.map(x=>{
162 163 (x._1._1,x._2)
163   - }).leftOuterJoin(performance).map(x=>(x._1,0.3*x._2._1+0.7*x._2._2.getOrElse(0.3D))).filter(x=>x._1.nonEmpty)
  164 + }).leftOuterJoin(performance).map(x=>(x._1,0.15*x._2._1+0.80*x._2._2.getOrElse(0.2D))).filter(x=>x._1.nonEmpty)
164 165  
165 166 val formatOutput: RDD[(String, Long)] = finalScore.map(x=>(x._1,(x._2*1000).toLong))
166 167