|
@@ -61,13 +61,13 @@ public class RankStrategy4RegionMergeModelV552 extends RankStrategy4RegionMergeM
|
|
List<Video> rovRecallRank = new ArrayList<>(v0);
|
|
List<Video> rovRecallRank = new ArrayList<>(v0);
|
|
//-------------------return相似召回------------------
|
|
//-------------------return相似召回------------------
|
|
List<Video> v6 = extractAndSort(param, ReturnVideoRecallStrategy.PUSH_FORM);
|
|
List<Video> v6 = extractAndSort(param, ReturnVideoRecallStrategy.PUSH_FORM);
|
|
- v6 = v6.stream().filter(r-> !setVideo.contains(r.getVideoId())).collect(Collectors.toList());
|
|
|
|
|
|
+ v6 = v6.stream().filter(r -> !setVideo.contains(r.getVideoId())).collect(Collectors.toList());
|
|
v6 = v6.subList(0, Math.min(mergeWeight.getOrDefault("v6", 5.0).intValue(), v6.size()));
|
|
v6 = v6.subList(0, Math.min(mergeWeight.getOrDefault("v6", 5.0).intValue(), v6.size()));
|
|
rovRecallRank.addAll(v6);
|
|
rovRecallRank.addAll(v6);
|
|
setVideo.addAll(v6.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
setVideo.addAll(v6.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
//-------------------新地域召回------------------
|
|
//-------------------新地域召回------------------
|
|
List<Video> v1 = extractAndSort(param, RegionRealtimeRecallStrategyV1.PUSH_FORM);
|
|
List<Video> v1 = extractAndSort(param, RegionRealtimeRecallStrategyV1.PUSH_FORM);
|
|
- v1 = v1.stream().filter(r-> !setVideo.contains(r.getVideoId())).collect(Collectors.toList());
|
|
|
|
|
|
+ v1 = v1.stream().filter(r -> !setVideo.contains(r.getVideoId())).collect(Collectors.toList());
|
|
v1 = v1.subList(0, Math.min(mergeWeight.getOrDefault("v1", 5.0).intValue(), v1.size()));
|
|
v1 = v1.subList(0, Math.min(mergeWeight.getOrDefault("v1", 5.0).intValue(), v1.size()));
|
|
rovRecallRank.addAll(v1);
|
|
rovRecallRank.addAll(v1);
|
|
setVideo.addAll(v1.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
setVideo.addAll(v1.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
@@ -198,7 +198,6 @@ public class RankStrategy4RegionMergeModelV552 extends RankStrategy4RegionMergeM
|
|
new Tuple4(b11, b12, b13, "b111213"),
|
|
new Tuple4(b11, b12, b13, "b111213"),
|
|
new Tuple4(b17, b18, b19, "b171819")
|
|
new Tuple4(b17, b18, b19, "b171819")
|
|
);
|
|
);
|
|
- Stopwatch stopwatch2 = Stopwatch.createStarted();
|
|
|
|
|
|
|
|
for (Tuple4 tuple4 : originData) {
|
|
for (Tuple4 tuple4 : originData) {
|
|
for (String prefix2 : Arrays.asList("1h", "2h", "3h", "4h", "12h", "1d", "3d", "7d")) {
|
|
for (String prefix2 : Arrays.asList("1h", "2h", "3h", "4h", "12h", "1d", "3d", "7d")) {
|
|
@@ -226,9 +225,6 @@ public class RankStrategy4RegionMergeModelV552 extends RankStrategy4RegionMergeM
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- log.info("loop 1 cost={}", stopwatch2.elapsed(TimeUnit.MILLISECONDS));
|
|
|
|
- stopwatch2.reset().start();
|
|
|
|
-
|
|
|
|
Map<String, String> videoInfo = featureOriginVideo.getOrDefault(vid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
|
|
Map<String, String> videoInfo = featureOriginVideo.getOrDefault(vid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
|
|
featureMap.put("total_time", Double.parseDouble(videoInfo.getOrDefault("total_time", "0")));
|
|
featureMap.put("total_time", Double.parseDouble(videoInfo.getOrDefault("total_time", "0")));
|
|
featureMap.put("bit_rate", Double.parseDouble(videoInfo.getOrDefault("bit_rate", "0")));
|
|
featureMap.put("bit_rate", Double.parseDouble(videoInfo.getOrDefault("bit_rate", "0")));
|
|
@@ -239,7 +235,10 @@ public class RankStrategy4RegionMergeModelV552 extends RankStrategy4RegionMergeM
|
|
for (String key_time : Arrays.asList("tags_1d", "tags_3d", "tags_7d")) {
|
|
for (String key_time : Arrays.asList("tags_1d", "tags_3d", "tags_7d")) {
|
|
String tags = c34567Map.getOrDefault(name + "_" + key_time, "");
|
|
String tags = c34567Map.getOrDefault(name + "_" + key_time, "");
|
|
if (!tags.isEmpty()) {
|
|
if (!tags.isEmpty()) {
|
|
|
|
+ Stopwatch stopwatch2 = Stopwatch.createStarted();
|
|
Double[] doubles = ExtractorUtils.funcC34567ForTags(tags, title);
|
|
Double[] doubles = ExtractorUtils.funcC34567ForTags(tags, title);
|
|
|
|
+ log.info("funcC34567ForTags cost={} tags={} title={}",
|
|
|
|
+ stopwatch2.elapsed(TimeUnit.MILLISECONDS), tags, title);
|
|
featureMap.put(name + "_" + key_time + "_matchnum", doubles[0]);
|
|
featureMap.put(name + "_" + key_time + "_matchnum", doubles[0]);
|
|
featureMap.put(name + "_" + key_time + "_maxscore", doubles[1]);
|
|
featureMap.put(name + "_" + key_time + "_maxscore", doubles[1]);
|
|
featureMap.put(name + "_" + key_time + "_avgscore", doubles[2]);
|
|
featureMap.put(name + "_" + key_time + "_avgscore", doubles[2]);
|
|
@@ -248,8 +247,6 @@ public class RankStrategy4RegionMergeModelV552 extends RankStrategy4RegionMergeM
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- log.info("loop 2 cost={}", stopwatch2.elapsed(TimeUnit.MILLISECONDS));
|
|
|
|
- stopwatch2.reset().start();
|
|
|
|
|
|
|
|
if (!vid.isEmpty()) {
|
|
if (!vid.isEmpty()) {
|
|
for (String key_feature : Arrays.asList("c8_feature", "c9_feature")) {
|
|
for (String key_feature : Arrays.asList("c8_feature", "c9_feature")) {
|
|
@@ -274,8 +271,6 @@ public class RankStrategy4RegionMergeModelV552 extends RankStrategy4RegionMergeM
|
|
featureMap.put("d1_rovn", Double.parseDouble(d1.getOrDefault("rovn", "0")));
|
|
featureMap.put("d1_rovn", Double.parseDouble(d1.getOrDefault("rovn", "0")));
|
|
}
|
|
}
|
|
item.featureMapDouble = featureMap;
|
|
item.featureMapDouble = featureMap;
|
|
- log.info("loop 3 cost={}", stopwatch2.elapsed(TimeUnit.MILLISECONDS));
|
|
|
|
- stopwatch2.reset().start();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
log.info("handle feature 2 cost={}", stopwatch.elapsed(TimeUnit.MILLISECONDS));
|
|
log.info("handle feature 2 cost={}", stopwatch.elapsed(TimeUnit.MILLISECONDS));
|
|
@@ -322,7 +317,7 @@ public class RankStrategy4RegionMergeModelV552 extends RankStrategy4RegionMergeM
|
|
|
|
|
|
List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_20240807.conf")
|
|
List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_20240807.conf")
|
|
.scoring(sceneFeatureMap, userFeatureMap, rankItems);
|
|
.scoring(sceneFeatureMap, userFeatureMap, rankItems);
|
|
- String redisScoreKey = mergeWeight.getOrDefault("redisScoreKey", 0.0) < 0.5 ? "redis:vid_hasreturn_rov:" : "redis:vid_hasreturn_rov_7d:";
|
|
|
|
|
|
+ String redisScoreKey = mergeWeight.getOrDefault("redisScoreKey", 0.0) < 0.5 ? "redis:vid_hasreturn_rov:" : "redis:vid_hasreturn_rov_7d:";
|
|
Map<String, Map<String, String>> vid2MapFeature = this.getVideoRedisFeature(vids, redisScoreKey);
|
|
Map<String, Map<String, String>> vid2MapFeature = this.getVideoRedisFeature(vids, redisScoreKey);
|
|
List<Video> result = new ArrayList<>();
|
|
List<Video> result = new ArrayList<>();
|
|
String hasReturnRovKey = mergeWeight.getOrDefault("hasReturnRovKey", 1.0) < 0.5 ? "rate_1" : "rate_n";
|
|
String hasReturnRovKey = mergeWeight.getOrDefault("hasReturnRovKey", 1.0) < 0.5 ? "rate_1" : "rate_n";
|
|
@@ -337,11 +332,11 @@ public class RankStrategy4RegionMergeModelV552 extends RankStrategy4RegionMergeM
|
|
item.getScoresMap().put("fmRovOrigin", fmRovOrigin);
|
|
item.getScoresMap().put("fmRovOrigin", fmRovOrigin);
|
|
double fmRov = restoreScore(fmRovOrigin);
|
|
double fmRov = restoreScore(fmRovOrigin);
|
|
item.getScoresMap().put("fmRov", fmRov);
|
|
item.getScoresMap().put("fmRov", fmRov);
|
|
- if (chooseFunction == 0){
|
|
|
|
|
|
+ if (chooseFunction == 0) {
|
|
score = fmRov * (1 + hasReturnRovScore);
|
|
score = fmRov * (1 + hasReturnRovScore);
|
|
- }else if (chooseFunction == 1){
|
|
|
|
|
|
+ } else if (chooseFunction == 1) {
|
|
score = fmRov * (1 + Math.log(hasReturnRovScore + 1));
|
|
score = fmRov * (1 + Math.log(hasReturnRovScore + 1));
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
score = fmRov * ExtractorUtils.sigmoid(hasReturnRovScore);
|
|
score = fmRov * ExtractorUtils.sigmoid(hasReturnRovScore);
|
|
}
|
|
}
|
|
|
|
|