|
|
@@ -29,6 +29,15 @@ import java.util.stream.Stream;
|
|
|
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
+/**
|
|
|
+ * V566 实验:基于 V563,按"供给类型(supply_type) + 驱动策略(driving_strategy)"对 item 加权/降权。
|
|
|
+ * 数据来源: alg_vid_feature_basic_info.feature JSON。
|
|
|
+ * 规则(硬编码,见 {@link #getSupplyWeight}):
|
|
|
+ * - supply_type ∈ {UGC, 垂直spider} → 0.8
|
|
|
+ * - supply_type = 自动AGC AND driving_strategy = 当下供需gap → 1.5
|
|
|
+ * - supply_type = 人工AGC AND driving_strategy ∈ {人工历史需求, 当下供需gap} → 1.2
|
|
|
+ * - 其他 → 1.0
|
|
|
+ */
|
|
|
public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeModelBasic {
|
|
|
@ApolloJsonValue("${rank.score.merge.weightv566:}")
|
|
|
private Map<String, Double> mergeWeight;
|
|
|
@@ -36,6 +45,10 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
|
|
|
@Autowired
|
|
|
private FeatureService featureService;
|
|
|
|
|
|
+ // V566 供给加权规则用到的常量
|
|
|
+ private static final Set<String> SUPPLY_DEMOTE_TYPES = new HashSet<>(Arrays.asList("UGC", "垂直spider"));
|
|
|
+ private static final Set<String> AGC_BOOST_DRIVINGS = new HashSet<>(Arrays.asList("人工历史需求", "当下供需gap"));
|
|
|
+
|
|
|
@Override
|
|
|
public List<Video> mergeAndRankRovRecall(RankParam param) {
|
|
|
Map<String, Double> mergeWeight = this.mergeWeight != null ? this.mergeWeight : new HashMap<>(0);
|
|
|
@@ -136,7 +149,7 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
|
|
|
|
|
|
// 4. 排序模型计算
|
|
|
Map<String, Float> sceneFeatureMap = new HashMap<>(0);
|
|
|
- List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_str_ros_dnn_20260424.conf").scoring(sceneFeatureMap, userFeatureMap, rankItems);
|
|
|
+ List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_dnn_20260407.conf").scoring(sceneFeatureMap, userFeatureMap, rankItems);
|
|
|
|
|
|
// 5. 排序公式特征
|
|
|
double xgbRovNegRate = mergeWeight.getOrDefault("xgbRovNegRate", 0.059);
|
|
|
@@ -149,9 +162,6 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
|
|
|
double vorAdd = mergeWeight.getOrDefault("vor_add", 0.1d);
|
|
|
double vorW = mergeWeight.getOrDefault("vor_w", 1.0d);
|
|
|
|
|
|
- double leaveW = mergeWeight.getOrDefault("leave_w", 1d);
|
|
|
- double leaveExp = mergeWeight.getOrDefault("leave_exp", 1d);
|
|
|
-
|
|
|
double c1Rovn1hW = mergeWeight.getOrDefault("c1_rovn_1h_w", 0d);
|
|
|
double c1Rovn24hW = mergeWeight.getOrDefault("c1_rovn_24h_w", 0d);
|
|
|
|
|
|
@@ -183,8 +193,9 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
|
|
|
double hasReturnRovScore = Double.parseDouble(vid2MapFeature.getOrDefault(item.getVideoId() + "", new HashMap<>()).getOrDefault("rov", "0"));
|
|
|
item.getScoresMap().put("hasReturnRovScore", hasReturnRovScore);
|
|
|
|
|
|
- double norXGBScore = item.getScoresMap().getOrDefault("NorXGBScore", 0d);
|
|
|
- double newNorXGBScore = norPowerCalibration(xgbNorPowerWeight, xgbNorPowerExp, norXGBScore);
|
|
|
+ double norDNNScore = item.getScoresMap().getOrDefault("NorDNNScore", 0d);
|
|
|
+ double newNorDNNScore = norPowerCalibration(xgbNorPowerWeight, xgbNorPowerExp, norDNNScore);
|
|
|
+ item.getScoresMap().put("newNorDNNScore", newNorDNNScore);
|
|
|
item.getScoresMap().put("rosAdd", rosAdd);
|
|
|
item.getScoresMap().put("rosW", rosW);
|
|
|
|
|
|
@@ -193,12 +204,6 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
|
|
|
item.getScoresMap().put("vorAdd", vorAdd);
|
|
|
item.getScoresMap().put("vorW", vorW);
|
|
|
|
|
|
- double pLeave = item.getScoresMap().getOrDefault("pLeave", 0d);
|
|
|
- double newPLeave = Math.pow((1 - leaveW * pLeave), leaveExp);
|
|
|
- item.getScoresMap().put("leaveW", leaveW);
|
|
|
- item.getScoresMap().put("leaveExp", leaveExp);
|
|
|
- item.getScoresMap().put("newPLeave", newPLeave);
|
|
|
-
|
|
|
Map<String, String> bcData = videoBCData.getOrDefault(String.valueOf(item.getVideoId()), new HashMap<>()).getOrDefault("alg_vid_feature_b_c_data", new HashMap<>());
|
|
|
Map<String, String> cdNData = videoBCData.getOrDefault(String.valueOf(item.getVideoId()), new HashMap<>()).getOrDefault("alg_vid_feature_cn_dn_data", new HashMap<>());
|
|
|
|
|
|
@@ -248,9 +253,26 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
|
|
|
item.getScoresMap().put("dnRovn24hW", dnRovn24hW);
|
|
|
item.getScoresMap().put("dnRovn24h", dnRovn24h);
|
|
|
|
|
|
- score = fmRov * (rosAdd + rosW * newNorXGBScore) * (vorAdd + vorW * vor) * newPLeave + c1RovnScore + b0StrScore + b0RorScore + cnRovnScore + dnRovnScore;
|
|
|
+ score = fmRov * (rosAdd + rosW * newNorDNNScore) * (vorAdd + vorW * vor) + c1RovnScore + b0StrScore + b0RorScore + cnRovnScore + dnRovnScore;
|
|
|
|
|
|
+ // ============== V566: 按供给类型 + 驱动策略加权 ==============
|
|
|
+ // 数据来源: alg_vid_feature_basic_info.feature.{supply_type, driving_strategy}
|
|
|
+ // 规则硬编码在 getSupplyWeight() 中
|
|
|
Video video = item.getVideo();
|
|
|
+ Map<String, String> vidBaseInfo = videoBaseInfoMap
|
|
|
+ .getOrDefault(String.valueOf(item.getVideoId()), Collections.emptyMap())
|
|
|
+ .getOrDefault("alg_vid_feature_basic_info", Collections.emptyMap());
|
|
|
+ String supplyType = vidBaseInfo.getOrDefault("supply_type", "unknown");
|
|
|
+ String drivingStrategy = vidBaseInfo.getOrDefault("driving_strategy", "unknown");
|
|
|
+ String sceneDimension = vidBaseInfo.getOrDefault("scene_dimension", "unknown");
|
|
|
+ double supplyTypeWeightValue = getSupplyWeight(supplyType, drivingStrategy);
|
|
|
+ item.getScoresMap().put("supplyType_" + supplyType, 1.0);
|
|
|
+ item.getScoresMap().put("drivingStrategy_" + drivingStrategy, 1.0);
|
|
|
+ item.getScoresMap().put("sceneDimension_" + sceneDimension, 1.0);
|
|
|
+ item.getScoresMap().put("supplyTypeWeight", supplyTypeWeightValue);
|
|
|
+ score = score * supplyTypeWeightValue;
|
|
|
+ // ============== V566 加权块结束 ==============
|
|
|
+
|
|
|
video.setScore(score);
|
|
|
video.setSortScore(score);
|
|
|
video.setScoresMap(item.getScoresMap());
|
|
|
@@ -382,7 +404,6 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
|
|
|
Map<String, Float> videoFeature = getVideoFeature(currentMs, vid, userProfile, creativeInfo, headInfo, rankInfo, c7Map, c8Map, userOriginInfo, historyVideoMap, videoOriginInfo);
|
|
|
featureMap.putAll(videoFeature);
|
|
|
item.featureMap = featureMap;
|
|
|
- item.norFeatureMap = item.featureMap;
|
|
|
|
|
|
Map<String, String> userNetworkSeqFeature = userOriginInfo.getOrDefault("alg_user_network_seq_feature", new HashMap<>());
|
|
|
|
|
|
@@ -463,4 +484,21 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
|
|
|
}
|
|
|
return newScore;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * V566 供给加权规则(硬编码)。
|
|
|
+ * 规则顺序固定:命中即返回,按业务优先级从高到低。
|
|
|
+ */
|
|
|
+ private double getSupplyWeight(String supplyType, String drivingStrategy) {
|
|
|
+ if (SUPPLY_DEMOTE_TYPES.contains(supplyType)) {
|
|
|
+ return 0.8;
|
|
|
+ }
|
|
|
+ if ("自动AGC".equals(supplyType) && "当下供需gap".equals(drivingStrategy)) {
|
|
|
+ return 1.5;
|
|
|
+ }
|
|
|
+ if ("人工AGC".equals(supplyType) && AGC_BOOST_DRIVINGS.contains(drivingStrategy)) {
|
|
|
+ return 1.2;
|
|
|
+ }
|
|
|
+ return 1.0;
|
|
|
+ }
|
|
|
}
|