wangyunpeng 14 часов назад
Родитель
Сommit
8d841cb3d3

+ 24 - 20
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV20Strategy.java

@@ -63,28 +63,32 @@ public class RankV20Strategy implements RankStrategy {
             double score;
             int index = weightService.getIndex(item.getContent().getContentPoolType(), contentPools);
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
-                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
-                        ScoreStrategyEnum.SIMILARITY.value())
-                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                double i2iScore = item.getScore(ScoreStrategyEnum.I2I_RECOMMEND_STRATEGY.value())
                         * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
-                        ScoreStrategyEnum.CATEGORY.value())
-                        + item.getScore(ScoreStrategyEnum.HIS_FISSION_OPEN_RATE.value())
-                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
-                        ScoreStrategyEnum.HIS_FISSION_OPEN_RATE.value())
-                        + item.getScore(ScoreStrategyEnum.I2I_RECOMMEND_STRATEGY.value())
-                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
-                        ScoreStrategyEnum.I2I_RECOMMEND_STRATEGY.value())
-                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value())
-                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value());
-                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
-                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                        ScoreStrategyEnum.I2I_RECOMMEND_STRATEGY.value());
+                if (i2iScore > 0) {
+                    score = i2iScore;
+                } else {
+                    score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
                             * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
-                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
-                }
-                if (item.getScore(ScoreStrategyEnum.HIS_FISSION_OPEN_RATE.value()) == 0) {
-                    score += hisFissionOpenRateMissingBaseline * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
-                            ScoreStrategyEnum.HIS_FISSION_OPEN_RATE.value());
+                            ScoreStrategyEnum.SIMILARITY.value())
+                            + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.CATEGORY.value())
+                            + item.getScore(ScoreStrategyEnum.HIS_FISSION_OPEN_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.HIS_FISSION_OPEN_RATE.value())
+                            + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value())
+                            + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value());
+                    if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                        score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                                * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                                ScoreStrategyEnum.VIEW_COUNT_RATE.value());
+                    }
+                    if (item.getScore(ScoreStrategyEnum.HIS_FISSION_OPEN_RATE.value()) == 0) {
+                        score += hisFissionOpenRateMissingBaseline * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                                ScoreStrategyEnum.HIS_FISSION_OPEN_RATE.value());
+                    }
                 }
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
                 score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())

+ 2 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/strategy/I2IRecommendStrategy.java

@@ -49,7 +49,7 @@ public class I2IRecommendStrategy implements ScoreStrategy {
                         double logScore = Math.log(recommendScore + eps);
                         // ② 用你真实分布的 log 区间归一化
                         double logMin = Math.log(0.0001);
-                        double logMax = Math.log(0.18);
+                        double logMax = Math.log(100);
                         double normalized = (logScore - logMin) / (logMax - logMin);
                         normalized = Math.max(0.0, Math.min(1.0, normalized));
                         // ③ 指数拉开头部
@@ -59,7 +59,7 @@ public class I2IRecommendStrategy implements ScoreStrategy {
                         double stretched = Math.pow(expScore, 2.2);
                         // ⑤ 映射到 0~2
                         double amplifiedScore = stretched * 2.0;
-                        double weightedScore = 2.0 + amplifiedScore;
+                        double weightedScore = 10.0 + amplifiedScore;
 
                         score.setScore(weightedScore);
                         scores.add(score);