|
@@ -10,6 +10,7 @@ import com.tzld.piaoquan.recommend.server.service.rank.extractor.ExtractorUtils;
|
|
import com.tzld.piaoquan.recommend.server.service.recall.strategy.*;
|
|
import com.tzld.piaoquan.recommend.server.service.recall.strategy.*;
|
|
import com.tzld.piaoquan.recommend.server.service.score.ScorerUtils;
|
|
import com.tzld.piaoquan.recommend.server.service.score.ScorerUtils;
|
|
import com.tzld.piaoquan.recommend.server.util.CommonCollectionUtils;
|
|
import com.tzld.piaoquan.recommend.server.util.CommonCollectionUtils;
|
|
|
|
+import com.tzld.piaoquan.recommend.server.util.FeatureUtils;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.MapUtils;
|
|
import org.apache.commons.collections4.MapUtils;
|
|
import org.apache.commons.math3.util.Pair;
|
|
import org.apache.commons.math3.util.Pair;
|
|
@@ -77,18 +78,17 @@ public class RankStrategy4RegionMergeModelV568 extends RankStrategy4RegionMergeM
|
|
sceneCFRosn = sceneCFRosn.subList(0, Math.min(mergeWeight.getOrDefault("sceneCFRosn", 5.0).intValue(), sceneCFRosn.size()));
|
|
sceneCFRosn = sceneCFRosn.subList(0, Math.min(mergeWeight.getOrDefault("sceneCFRosn", 5.0).intValue(), sceneCFRosn.size()));
|
|
rovRecallRank.addAll(sceneCFRosn);
|
|
rovRecallRank.addAll(sceneCFRosn);
|
|
setVideo.addAll(sceneCFRosn.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
setVideo.addAll(sceneCFRosn.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
- //-------------------省份ros指标实时召回------------------
|
|
|
|
- List<Video> hourROSRecall = extractAndSort(param, RegionRealtimeRecallStrategyROS.PUSH_FORM);
|
|
|
|
- hourROSRecall = hourROSRecall.stream().filter(r -> !setVideo.contains(r.getVideoId())).collect(Collectors.toList());
|
|
|
|
- hourROSRecall = hourROSRecall.subList(0, Math.min(mergeWeight.getOrDefault("hourROSRecall", 5.0).intValue(), hourROSRecall.size()));
|
|
|
|
- rovRecallRank.addAll(hourROSRecall);
|
|
|
|
- setVideo.addAll(hourROSRecall.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
|
|
- //-------------------长周期ros------------------
|
|
|
|
- List<Video> LongTermROSRecall = extractAndSort(param, RegionRealtimeRecallStrategyV7LongTermV1.PUSH_FORM);
|
|
|
|
- LongTermROSRecall = LongTermROSRecall.stream().filter(r -> !setVideo.contains(r.getVideoId())).collect(Collectors.toList());
|
|
|
|
- LongTermROSRecall = LongTermROSRecall.subList(0, Math.min(mergeWeight.getOrDefault("LongTermROSRecall", 1.0).intValue(), LongTermROSRecall.size()));
|
|
|
|
- rovRecallRank.addAll(LongTermROSRecall);
|
|
|
|
- setVideo.addAll(LongTermROSRecall.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
|
|
|
|
+ if (FeatureUtils.lowFissionChannel(param.getRootSourceId())) {
|
|
|
|
+ // head cate1 str
|
|
|
|
+ int headCate1StrN = mergeWeight.getOrDefault("headCate1StrN", 5.0).intValue();
|
|
|
|
+ addRecall(param, headCate1StrN, HeadCate1STRRecallStrategy.PUSH_FORM, setVideo, rovRecallRank);
|
|
|
|
+ // head cate2 str
|
|
|
|
+ int headCate2StrN = mergeWeight.getOrDefault("headCate2StrN", 5.0).intValue();
|
|
|
|
+ addRecall(param, headCate2StrN, HeadCate2STRRecallStrategy.PUSH_FORM, setVideo, rovRecallRank);
|
|
|
|
+ // province str
|
|
|
|
+ int provinceStrN = mergeWeight.getOrDefault("provinceStrN", 5.0).intValue();
|
|
|
|
+ addRecall(param, provinceStrN, ProvinceSTRRecallStrategy.PUSH_FORM, setVideo, rovRecallRank);
|
|
|
|
+ }
|
|
|
|
|
|
//-------------------排-------------------
|
|
//-------------------排-------------------
|
|
//-------------------序-------------------
|
|
//-------------------序-------------------
|
|
@@ -357,4 +357,14 @@ public class RankStrategy4RegionMergeModelV568 extends RankStrategy4RegionMergeM
|
|
result.sort(Comparator.comparingDouble(o -> -o.getSortScore()));
|
|
result.sort(Comparator.comparingDouble(o -> -o.getSortScore()));
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void addRecall(RankParam param, int recallNum, String recallName, Set<Long> setVideo, List<Video> rovRecallRank) {
|
|
|
|
+ if (recallNum > 0) {
|
|
|
|
+ List<Video> list = extractAndSort(param, recallName);
|
|
|
|
+ list = list.stream().filter(r -> !setVideo.contains(r.getVideoId())).collect(Collectors.toList());
|
|
|
|
+ list = list.subList(0, Math.min(recallNum, list.size()));
|
|
|
|
+ rovRecallRank.addAll(list);
|
|
|
|
+ setVideo.addAll(list.stream().map(Video::getVideoId).collect(Collectors.toSet()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|