|
@@ -143,19 +143,6 @@ public class RankStrategy4RegionMergeModelV3 extends RankService {
|
|
//-------------------序-------------------
|
|
//-------------------序-------------------
|
|
//-------------------逻-------------------
|
|
//-------------------逻-------------------
|
|
//-------------------辑-------------------
|
|
//-------------------辑-------------------
|
|
-// List<String> videoIdKeys = rovRecallRank.stream()
|
|
|
|
-// .map(t -> param.getRankKeyPrefix() + t.getVideoId())
|
|
|
|
-// .collect(Collectors.toList());
|
|
|
|
-// List<String> videoScores = this.redisTemplate.opsForValue().multiGet(videoIdKeys);
|
|
|
|
-// log.info("rank mergeAndRankRovRecall videoIdKeys={}, videoScores={}", JSONUtils.toJson(videoIdKeys),
|
|
|
|
-// JSONUtils.toJson(videoScores));
|
|
|
|
-// if (CollectionUtils.isNotEmpty(videoScores)
|
|
|
|
-// && videoScores.size() == rovRecallRank.size()) {
|
|
|
|
-// for (int i = 0; i < videoScores.size(); i++) {
|
|
|
|
-// rovRecallRank.get(i).setSortScore(NumberUtils.toDouble(videoScores.get(i), 0.0));
|
|
|
|
-// }
|
|
|
|
-// Collections.sort(rovRecallRank, Comparator.comparingDouble(o -> -o.getSortScore()));
|
|
|
|
-// }
|
|
|
|
|
|
|
|
// 1 模型分
|
|
// 1 模型分
|
|
List<String> rtFeaPart = new ArrayList<>();
|
|
List<String> rtFeaPart = new ArrayList<>();
|
|
@@ -325,12 +312,6 @@ public class RankStrategy4RegionMergeModelV3 extends RankService {
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
log.error(String.format("parse user json is wrong in {} with {}", this.CLASS_NAME, e));
|
|
log.error(String.format("parse user json is wrong in {} with {}", this.CLASS_NAME, e));
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- JSONObject obj = new JSONObject();
|
|
|
|
- obj.put("name", "user_key_in_model_is_null");
|
|
|
|
- obj.put("class", this.CLASS_NAME);
|
|
|
|
-// log.info(obj.toString());
|
|
|
|
-// return videos;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
final Set<String> userFeatureSet = new HashSet<>(Arrays.asList(
|
|
final Set<String> userFeatureSet = new HashSet<>(Arrays.asList(
|
|
@@ -359,7 +340,6 @@ public class RankStrategy4RegionMergeModelV3 extends RankService {
|
|
);
|
|
);
|
|
f1.putAll(f2);
|
|
f1.putAll(f2);
|
|
f1.putAll(f3);
|
|
f1.putAll(f3);
|
|
-// log.info("userFeature in model = {}", JSONUtils.toJson(f1));
|
|
|
|
|
|
|
|
// 2-1: item特征处理
|
|
// 2-1: item特征处理
|
|
final Set<String> itemFeatureSet = new HashSet<>(Arrays.asList(
|
|
final Set<String> itemFeatureSet = new HashSet<>(Arrays.asList(
|
|
@@ -495,17 +475,9 @@ public class RankStrategy4RegionMergeModelV3 extends RankService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-// log.info("ItemFeature = {}", JSONUtils.toJson(videoFeatures));
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
List<RankItem> rovRecallScore = ScorerUtils.getScorerPipeline(ScorerUtils.BASE_CONF)
|
|
List<RankItem> rovRecallScore = ScorerUtils.getScorerPipeline(ScorerUtils.BASE_CONF)
|
|
.scoring(sceneFeatureMap, userFeatureMap, rankItems);
|
|
.scoring(sceneFeatureMap, userFeatureMap, rankItems);
|
|
-// log.info("mergeAndRankRovRecallNew rovRecallScore={}", JSONUtils.toJson(rovRecallScore));
|
|
|
|
- JSONObject obj = new JSONObject();
|
|
|
|
- obj.put("name", "user_key_in_model_is_not_null");
|
|
|
|
- obj.put("class", this.CLASS_NAME);
|
|
|
|
-// log.info(obj.toString());
|
|
|
|
return rovRecallScore;
|
|
return rovRecallScore;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -580,7 +552,6 @@ public class RankStrategy4RegionMergeModelV3 extends RankService {
|
|
int rovPoolIndex = param.getTopK();
|
|
int rovPoolIndex = param.getTopK();
|
|
for (int i = 0; i < param.getSize() - param.getTopK(); i++) {
|
|
for (int i = 0; i < param.getSize() - param.getTopK(); i++) {
|
|
double rand = RandomUtils.nextDouble(0, 1);
|
|
double rand = RandomUtils.nextDouble(0, 1);
|
|
- log.info("rand={}, flowPoolP={}", rand, flowPoolP);
|
|
|
|
if (rand < flowPoolP) {
|
|
if (rand < flowPoolP) {
|
|
if (flowPoolIndex < flowVideos.size()) {
|
|
if (flowPoolIndex < flowVideos.size()) {
|
|
result.add(flowVideos.get(flowPoolIndex++));
|
|
result.add(flowVideos.get(flowPoolIndex++));
|