소스 검색

MOD: merge sort

sunxy 1 년 전
부모
커밋
c7d45b7621

+ 11 - 11
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/implement/candidate/Global1hHotCandidate.java

@@ -27,24 +27,24 @@ public class Global1hHotCandidate extends IndexCandidateQueue {
 
 
         BigDecimal recallNumBigDecimal = BigDecimal.valueOf(recallNum);
-        int combinationNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.8)).intValue();
-//        int strNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
-        int rosNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
-        int rovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
-//        int shortRovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
+        int combinationNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.3)).intValue();
+        int strNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
+        int rosNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.2)).intValue();
+        int rovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.3)).intValue();
+        int shortRovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
 
 
         QueueName queueName = new QueueName(ItemType, "rov")
                 .addMatch("type", "global1h");
         currRecall += addCandidateKey(simplifiedCandidates, queueName, rovNum, getStrategyQueueInfo().getQueueName());
 
-//        queueName = new QueueName(ItemType, "str")
-//                .addMatch("type", "global1h");
-//        currRecall += addCandidateKey(simplifiedCandidates, queueName, strNum, getStrategyQueueInfo().getQueueName());
+        queueName = new QueueName(ItemType, "str")
+                .addMatch("type", "global1h");
+        currRecall += addCandidateKey(simplifiedCandidates, queueName, strNum, getStrategyQueueInfo().getQueueName());
 
-//        queueName = new QueueName(ItemType, "short_rov")
-//                .addMatch("type", "global1h");
-//        currRecall += addCandidateKey(simplifiedCandidates, queueName, shortRovNum, getStrategyQueueInfo().getQueueName());
+        queueName = new QueueName(ItemType, "short_rov")
+                .addMatch("type", "global1h");
+        currRecall += addCandidateKey(simplifiedCandidates, queueName, shortRovNum, getStrategyQueueInfo().getQueueName());
 
         queueName = new QueueName(ItemType, "short_ros")
                 .addMatch("type", "global1h");

+ 15 - 15
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/implement/candidate/Region1hHotCandidate.java

@@ -27,11 +27,11 @@ public class Region1hHotCandidate extends IndexCandidateQueue {
         Map<String, Candidate> simplifiedCandidates = new ConcurrentHashMap<String, Candidate>();
 
         BigDecimal recallNumBigDecimal = BigDecimal.valueOf(recallNum);
-        int combinationNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.6)).intValue();
-//        int rosNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.2)).intValue();
-        int rovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
-        int shortRovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.3)).intValue();
-//        int strNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
+        int combinationNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.2)).intValue();
+        int rosNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.2)).intValue();
+        int rovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.4)).intValue();
+        int shortRovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
+        int strNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
 
 
         QueueName queueName = new QueueName(ItemType, "short_rov")
@@ -47,11 +47,11 @@ public class Region1hHotCandidate extends IndexCandidateQueue {
         currRecall += addCandidateKey(simplifiedCandidates, queueName, rovNum,
                 getStrategyQueueInfo().getQueueName());
 
-//        queueName = new QueueName(ItemType, "short_ros")
-//                .addMatch("type", "region1h")
-//                .addMatch("region", region);
-//        currRecall += addCandidateKey(simplifiedCandidates, queueName, rosNum,
-//                getStrategyQueueInfo().getQueueName());
+        queueName = new QueueName(ItemType, "short_ros")
+                .addMatch("type", "region1h")
+                .addMatch("region", region);
+        currRecall += addCandidateKey(simplifiedCandidates, queueName, rosNum,
+                getStrategyQueueInfo().getQueueName());
 
         queueName = new QueueName(ItemType, "combination")
                 .addMatch("type", "region1h")
@@ -59,11 +59,11 @@ public class Region1hHotCandidate extends IndexCandidateQueue {
         currRecall += addCandidateKey(simplifiedCandidates, queueName, combinationNum,
                 getStrategyQueueInfo().getQueueName());
 
-//        queueName = new QueueName(ItemType, "str")
-//                .addMatch("type", "region1h")
-//                .addMatch("region", region);
-//        currRecall += addCandidateKey(simplifiedCandidates, queueName, strNum,
-//                getStrategyQueueInfo().getQueueName());
+        queueName = new QueueName(ItemType, "str")
+                .addMatch("type", "region1h")
+                .addMatch("region", region);
+        currRecall += addCandidateKey(simplifiedCandidates, queueName, strNum,
+                getStrategyQueueInfo().getQueueName());
 
         candidates.putAll(simplifiedCandidates);
         return currRecall;

+ 8 - 8
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/implement/candidate/Region24hHotCandidate.java

@@ -28,10 +28,10 @@ public class Region24hHotCandidate extends IndexCandidateQueue {
 
 
         BigDecimal recallNumBigDecimal = BigDecimal.valueOf(recallNum);
-        int combinationNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.6)).intValue();
+        int combinationNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.2)).intValue();
         int rosNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.3)).intValue();
-        int rovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
-//        int strNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
+        int rovNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.4)).intValue();
+        int strNum = recallNumBigDecimal.multiply(BigDecimal.valueOf(0.1)).intValue();
 
         // index key  video:queue:type=region24h:region=北京:ordering=rov
         QueueName queueName = new QueueName(ItemType, "rov")
@@ -54,11 +54,11 @@ public class Region24hHotCandidate extends IndexCandidateQueue {
                 getStrategyQueueInfo().getQueueName());
 
         // index key  video:queue:type=region24h:region=北京:ordering=str
-//        queueName = new QueueName(ItemType, "str")
-//                .addMatch("type", "region24h")
-//                .addMatch("region", region);
-//        currRecall += addCandidateKey(simplifiedCandidates, queueName, strNum,
-//                getStrategyQueueInfo().getQueueName());
+        queueName = new QueueName(ItemType, "str")
+                .addMatch("type", "region24h")
+                .addMatch("region", region);
+        currRecall += addCandidateKey(simplifiedCandidates, queueName, strNum,
+                getStrategyQueueInfo().getQueueName());
 
         candidates.putAll(simplifiedCandidates);
         return currRecall;

+ 14 - 23
recommend-server-service/src/main/resources/merge_config.conf

@@ -40,14 +40,12 @@ rule-config = {
     merge-rule = {
       global-hot-queue = {
         recall-percentage = 0.5
-        min-merge-num = 100
-        max-merge-num = 200
+        max-merge-num = 400
         priority = 1
       }
       region-hot-queue = {
         recall-percentage = 0.5
-        min-merge-num = 100
-        max-merge-num = 200
+        max-merge-num = 400
         priority = 1
       }
     }
@@ -57,19 +55,16 @@ rule-config = {
   global-hot-queue = {
     merge-rule = {
       global1h-index = {
-        recall-percentage = 0.7
-        min-merge-num = 140
-        max-merge-num = 280
+        recall-percentage = 0.3
+        max-merge-num = 200
       }
       global3h-index = {
-        recall-percentage = 0.1
-        min-merge-num = 20
-        max-merge-num = 40
+        recall-percentage = 0.3
+        max-merge-num = 200
       }
       global24h-index = {
-        recall-percentage = 0.2
-        min-merge-num = 40
-        max-merge-num = 80
+        recall-percentage = 0.3
+        max-merge-num = 200
       }
     }
   }
@@ -78,23 +73,19 @@ rule-config = {
   region-hot-queue = {
     merge-rule = {
       region1h-index = {
-        recall-percentage = 0.6
-        min-merge-num = 120
-        max-merge-num = 240
+        recall-percentage = 0.3
+        max-merge-num = 200
 
       }
       region3h-index = {
-        recall-percentage = 0.1
-        min-merge-num = 20
-        max-merge-num = 40
+        recall-percentage = 0.3
+        max-merge-num = 200
       }
       region24h-index = {
         recall-percentage = 0.3
-        min-merge-num = 60
-        max-merge-num = 120
+        max-merge-num = 200
       }
     }
   }
 
-}
-
+}