Parcourir la source

add ctr-sample proto 1205

sunmingze il y a 1 an
Parent
commit
8fb52c03c7

+ 49 - 0
recommend-server-client/src/main/proto/com/tzld/piaoquan/recommend/server/ctr_samples.proto

@@ -0,0 +1,49 @@
+syntax = "proto3";
+
+
+option java_multiple_files = true;
+option java_package = "com.tzld.piaoquan.recommend.server.gen.recommend";
+option java_generic_services = true;
+
+
+
+message FeatureGroup {
+    string type = 1;
+    int32 id = 2;
+    string name = 3;
+    string field = 4;
+}
+
+message BaseFeature {
+    int64 id = 1;
+    int64 identifier = 2;
+    string fea = 3;
+    double value = 4;
+    double weight =5;
+}
+
+
+message GroupedFeature {
+    FeatureGroup group = 1;
+    int32 count = 2;
+    repeated BaseFeature features = 3;
+}
+
+
+
+message LRWeight {
+    int32 group_num = 1;
+    repeated BaseFeature features = 2;
+}
+
+
+
+message LRSamples {
+    int32 is_click = 1;
+    int32 group_num = 2;
+    int32 count = 3;
+    repeated GroupedFeature features = 4;
+    double weight = 5;
+    double predict_ctr = 6;
+}
+

+ 3 - 3
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/common/base/RankItem.java

@@ -16,7 +16,7 @@ public class RankItem implements Comparable<RankItem> {
 
     public RankItem(Video video) {
         this.videoid = video.getVideoId() ;
-        this.rankScore = 0.0 ;
+        this.score = 0.0 ;
     }
 
     private Map<String, Double> rankerScore;
@@ -28,9 +28,9 @@ public class RankItem implements Comparable<RankItem> {
         if (o == null) {
             return -1;
         }
-        if (rankScore > o.rankScore) {
+        if (score > o.score) {
             return -1;
-        } else if (rankScore < o.rankScore) {
+        } else if (score < o.score) {
             return 1;
         } else {
             return 0;