|
@@ -2,6 +2,7 @@ package com.tzld.piaoquan.recommend.server.service.rank.strategy;
|
|
|
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.google.common.collect.Maps;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.google.common.reflect.TypeToken;
|
|
|
import com.tzld.piaoquan.recommend.server.common.ThreadPoolFactory;
|
|
|
import com.tzld.piaoquan.recommend.server.common.base.RankItem;
|
|
@@ -37,6 +38,7 @@ public class RankStrategy4RegionMergeModelV562 extends RankStrategy4RegionMergeM
|
|
|
|
|
|
private Map<Pair<Double, Double>, Pair<Double, Double>> strPlusCalibrationCoefficientMap = Maps.newLinkedHashMap();
|
|
|
|
|
|
+ private static final Set<String> HOT_SCENE_TYPE_SET = Sets.newHashSet("1007", "1008");
|
|
|
|
|
|
@Autowired
|
|
|
private FeatureService featureService;
|
|
@@ -342,6 +344,7 @@ public class RankStrategy4RegionMergeModelV562 extends RankStrategy4RegionMergeM
|
|
|
double fmRov = this.fmRovRestoreAndCalibration(item);
|
|
|
item.getScoresMap().put("fmRov", fmRov);
|
|
|
double hasReturnRovScore = this.calcHasReturnRovScore(vid2MapFeature.getOrDefault(item.getVideoId() + "", new HashMap<>()), param.getHotSceneType().toString(), item);
|
|
|
+ hasReturnRovScore = Math.pow(hasReturnRovScore, 1.1);
|
|
|
item.getScoresMap().put("hasReturnRovScore", hasReturnRovScore);
|
|
|
double vor = this.calcVorScore(vid2MapFeature.getOrDefault(item.getVideoId() + "", new HashMap<>()));
|
|
|
item.getScoresMap().put("vor", vor);
|
|
@@ -366,15 +369,20 @@ public class RankStrategy4RegionMergeModelV562 extends RankStrategy4RegionMergeM
|
|
|
private double calcHasReturnRovScore(Map<String, String> feature, String hotSceneType, RankItem item) {
|
|
|
|
|
|
try {
|
|
|
- Map<String, String> hotSceneJson = JSONUtils.fromJson(feature.getOrDefault(hotSceneType, "{}"), new TypeToken<Map<String, String>>() {
|
|
|
- }, new HashMap<>());
|
|
|
+
|
|
|
+ if (!HOT_SCENE_TYPE_SET.contains(hotSceneType)) {
|
|
|
+ hotSceneType = "other";
|
|
|
+ }
|
|
|
+
|
|
|
Map<String, String> sumJson = JSONUtils.fromJson(feature.getOrDefault("sum", "{}"), new TypeToken<Map<String, String>>() {
|
|
|
}, new HashMap<>());
|
|
|
+ Map<String, String> hotSceneJson = JSONUtils.fromJson(feature.getOrDefault(hotSceneType, "{}"), new TypeToken<Map<String, String>>() {
|
|
|
+ }, new HashMap<>());
|
|
|
|
|
|
- String hotSceneHasReturn = hotSceneJson.getOrDefault("hasreturn", "0");
|
|
|
String sumHasReturn = sumJson.getOrDefault("hasreturn", "0");
|
|
|
+ String hotSceneHasReturn = hotSceneJson.getOrDefault("hasreturn", sumHasReturn);
|
|
|
|
|
|
- item.getScoresMap().put("hotSceneHasReturn", Double.parseDouble(hotSceneHasReturn));
|
|
|
+ item.getScoresMap().put("hotSceneTypeHasReturn", Double.parseDouble(hotSceneHasReturn));
|
|
|
item.getScoresMap().put("sumHasReturn", Double.parseDouble(sumHasReturn));
|
|
|
|
|
|
return Stream.of(hotSceneHasReturn, sumHasReturn)
|
|
@@ -403,6 +411,12 @@ public class RankStrategy4RegionMergeModelV562 extends RankStrategy4RegionMergeM
|
|
|
// fmRov采样恢复
|
|
|
double fmRov = restoreScore(fmRovOrigin);
|
|
|
item.getScoresMap().put("fmRovRestore", fmRov);
|
|
|
+ if (fmRov < 0) {
|
|
|
+ fmRov = 0;
|
|
|
+ }
|
|
|
+ if (fmRov > 1) {
|
|
|
+ fmRov = 1;
|
|
|
+ }
|
|
|
try {
|
|
|
readCalibrationFile();
|
|
|
|