|
@@ -135,12 +135,16 @@ object recsys_01_ros_reg_xgb_train {
|
|
|
val vid = JSON.parseObject(rList(2)).getString("vid")
|
|
|
val label = rList(0).toDouble
|
|
|
val score = rList(1).toDouble
|
|
|
- (vid, (1, score))
|
|
|
+ (vid, (1, score, RosUtil.inverseLog(score)))
|
|
|
}).reduceByKey {
|
|
|
- case (c1, c2) => (c1._1 + c1._1, c2._2 + c2._2)
|
|
|
+ case (c1, c2) => (
|
|
|
+ c1._1 + c1._1,
|
|
|
+ c2._2 + c2._2,
|
|
|
+ c2._3 + c2._3
|
|
|
+ )
|
|
|
}.map {
|
|
|
- case (vid, (all, sumScore)) =>
|
|
|
- (vid, (all, sumScore, sumScore / all))
|
|
|
+ case (vid, (all, sumScore, sumScore2)) =>
|
|
|
+ (vid, (all, sumScore, sumScore / all, sumScore2, sumScore2 / all))
|
|
|
}.
|
|
|
collect().
|
|
|
sortBy(_._1).
|