Bladeren bron

Merge branch 'yxh/0911' of Server/long-article-recommend into master

yangxiaohui 9 maanden geleden
bovenliggende
commit
9855944745

+ 12 - 8
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/score/strategy/ViewCountRateStrategy.java

@@ -82,7 +82,7 @@ public class ViewCountRateStrategy implements ScoreStrategy {
                                 if (hisItem.getFirstViewCountRate() > 1) {
                                     // 对于头条均值倍数大于1的情况,次条均值线性增加,用于debias;
                                     // TODO: 对于小于1的情况,是否要减去?
-                                    avgViewCountSumSecond += hisItem.getAvgViewCount() * hisItem.getFirstViewCountRate();
+                                    avgViewCountSumSecond += hisItem.getAvgViewCount() * (hisItem.getFirstViewCountRate() - 1);
                                 } else {
                                     avgViewCountSumSecond += hisItem.getAvgViewCount();
                                 }
@@ -94,7 +94,7 @@ public class ViewCountRateStrategy implements ScoreStrategy {
                                 if (hisItem.getFirstViewCountRate() > 1) {
                                     // 对于头条均值倍数大于1的情况,次条均值线性增加,用于debias;
                                     // TODO: 对于小于1的情况,是否要减去?
-                                    avgViewCountSum += hisItem.getAvgViewCount() * hisItem.getFirstViewCountRate();
+                                    avgViewCountSum += hisItem.getAvgViewCount() * (hisItem.getFirstViewCountRate() - 1);
                                 } else {
                                     avgViewCountSum += hisItem.getAvgViewCount();
                                 }
@@ -103,7 +103,7 @@ public class ViewCountRateStrategy implements ScoreStrategy {
                     }
                 }
                 double viewCountRate = 0D; // 设置默认值
-                double minRate = 5D;
+                double bigRateW = 1D;
                 // 如果有头条反馈数据,优先选取头条反馈数据;
                 if (showViewCountSumFirst > 0) {
                     showViewCountSum = showViewCountSumFirst;
@@ -112,9 +112,9 @@ public class ViewCountRateStrategy implements ScoreStrategy {
                     showViewCountSum = showViewCountSumSecond;
                     avgViewCountSum = avgViewCountSumSecond;
                     // 如果是大号头条,则降权
-//                    if (avgViewCountFirst >= 2000 && i == 0) {
-//                        minRate = 1.001D;
-//                    }
+                    if (avgViewCountFirst >= 3000 && i == 0) {
+                        bigRateW = 0.001D;
+                    }
                 }
                 // 均值倍数
                 if (avgViewCountSum > 0) {
@@ -126,8 +126,12 @@ public class ViewCountRateStrategy implements ScoreStrategy {
 
                 if (viewCountRate > 0) {
                     // 最终分数 = 置信度 * 均值倍数
-                    viewCountRateScore = viewCountRateW * viewCountRate;
-//                    viewCountRateScore = (Math.min(viewCountRate, minRate) - 1D) * viewCountRateW;
+                    if (viewCountRate > 1 && bigRateW < 1) {
+                        // 如果是大号头条,则降权
+                        viewCountRateScore = viewCountRateW * ((viewCountRate - 1) * bigRateW + 1);
+                    } else {
+                        viewCountRateScore = viewCountRateW * viewCountRate;
+                    }
                 }
                 Score score = new Score();
                 score.setStrategy(this);