|
@@ -8,7 +8,6 @@ import com.tzld.piaoquan.recommend.server.model.MachineInfo;
|
|
|
import com.tzld.piaoquan.recommend.server.model.Video;
|
|
import com.tzld.piaoquan.recommend.server.model.Video;
|
|
|
import com.tzld.piaoquan.recommend.server.service.FeatureService;
|
|
import com.tzld.piaoquan.recommend.server.service.FeatureService;
|
|
|
import com.tzld.piaoquan.recommend.server.service.rank.RankParam;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.RankParam;
|
|
|
-import com.tzld.piaoquan.recommend.server.service.rank.bo.UserSRBO;
|
|
|
|
|
import com.tzld.piaoquan.recommend.server.service.rank.bo.UserShareReturnProfile;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.bo.UserShareReturnProfile;
|
|
|
import com.tzld.piaoquan.recommend.server.service.rank.extractor.ExtractVideoMergeCate;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.extractor.ExtractVideoMergeCate;
|
|
|
import com.tzld.piaoquan.recommend.server.service.rank.tansform.FeatureV6;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.tansform.FeatureV6;
|
|
@@ -75,6 +74,10 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
|
|
|
RecallUtils.extractRecall(mergeWeight.getOrDefault("prioriProvinceStr", 1.0).intValue(), param, PrioriProvinceStrRecallStrategy.PUSH_FROM, setVideo, rovRecallRank);
|
|
RecallUtils.extractRecall(mergeWeight.getOrDefault("prioriProvinceStr", 1.0).intValue(), param, PrioriProvinceStrRecallStrategy.PUSH_FROM, setVideo, rovRecallRank);
|
|
|
//-------------------priori province ros------------------
|
|
//-------------------priori province ros------------------
|
|
|
RecallUtils.extractRecall(mergeWeight.getOrDefault("prioriProvinceRos", 1.0).intValue(), param, PrioriProvinceRosRecallStrategy.PUSH_FROM, setVideo, rovRecallRank);
|
|
RecallUtils.extractRecall(mergeWeight.getOrDefault("prioriProvinceRos", 1.0).intValue(), param, PrioriProvinceRosRecallStrategy.PUSH_FROM, setVideo, rovRecallRank);
|
|
|
|
|
+ //-------------------return1 cate2 ros------------------
|
|
|
|
|
+ RecallUtils.extractRecall(mergeWeight.getOrDefault("return1Cate2Ros", 5.0).intValue(), param, Return1Cate2RosRecallStrategy.PUSH_FORM, setVideo, rovRecallRank);
|
|
|
|
|
+ //-------------------return1 cate2 str------------------
|
|
|
|
|
+ RecallUtils.extractRecall(mergeWeight.getOrDefault("return1Cate2Str", 5.0).intValue(), param, Return1Cate2StrRecallStrategy.PUSH_FORM, setVideo, rovRecallRank);
|
|
|
|
|
|
|
|
//-------------------排-------------------
|
|
//-------------------排-------------------
|
|
|
//-------------------序-------------------
|
|
//-------------------序-------------------
|
|
@@ -84,29 +87,29 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
|
|
|
|
|
|
|
|
// 1. 批量获取特征 省份参数要对齐 headvid 要传递过来!
|
|
// 1. 批量获取特征 省份参数要对齐 headvid 要传递过来!
|
|
|
// k1:视频、k2:表、k3:特征、v:特征值
|
|
// k1:视频、k2:表、k3:特征、v:特征值
|
|
|
|
|
+ Map<String, String> headVideoInfo = param.getHeadInfo();
|
|
|
List<String> vids = CommonCollectionUtils.toListDistinct(rovRecallRank, v -> String.valueOf(v.getVideoId()));
|
|
List<String> vids = CommonCollectionUtils.toListDistinct(rovRecallRank, v -> String.valueOf(v.getVideoId()));
|
|
|
- String headVid = String.valueOf(param.getHeadVid());
|
|
|
|
|
- Map<String, Map<String, Map<String, String>>> videoBaseInfoMap = featureService.getVideoBaseInfo(headVid, vids);
|
|
|
|
|
- FeatureService.Feature feature = featureService.getFeatureV3(param, videoBaseInfoMap, vids);
|
|
|
|
|
|
|
+ Map<String, Map<String, Map<String, String>>> videoBaseInfoMap = featureService.getVideoBaseInfo("", vids);
|
|
|
|
|
+ FeatureService.Feature feature = featureService.getFeatureV4(param, headVideoInfo, videoBaseInfoMap, vids);
|
|
|
Map<String, Map<String, String>> featureOriginUser = feature.getUserFeature();
|
|
Map<String, Map<String, String>> featureOriginUser = feature.getUserFeature();
|
|
|
Map<String, Map<String, Map<String, String>>> featureOriginVideo = feature.getVideoFeature();
|
|
Map<String, Map<String, Map<String, String>>> featureOriginVideo = feature.getVideoFeature();
|
|
|
- Map<String, String> headVideoInfo = videoBaseInfoMap.getOrDefault(headVid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
|
|
|
|
|
|
|
|
|
|
// 2. 用户信息预处理
|
|
// 2. 用户信息预处理
|
|
|
Map<String, Map<String, String[]>> newC7Map = FeatureV6.parseUCFScore(featureOriginUser.getOrDefault("alg_mid_feature_sharecf", new HashMap<>()));
|
|
Map<String, Map<String, String[]>> newC7Map = FeatureV6.parseUCFScore(featureOriginUser.getOrDefault("alg_mid_feature_sharecf", new HashMap<>()));
|
|
|
Map<String, Map<String, String[]>> newC8Map = FeatureV6.parseUCFScore(featureOriginUser.getOrDefault("alg_mid_feature_returncf", new HashMap<>()));
|
|
Map<String, Map<String, String[]>> newC8Map = FeatureV6.parseUCFScore(featureOriginUser.getOrDefault("alg_mid_feature_returncf", new HashMap<>()));
|
|
|
UserShareReturnProfile userProfile = parseUserProfile(featureOriginUser);
|
|
UserShareReturnProfile userProfile = parseUserProfile(featureOriginUser);
|
|
|
- Map<String, Map<String, String>> userBehaviorVideoMap = getUserBehaviorVideoMap(userProfile);
|
|
|
|
|
|
|
+ Map<String, Map<String, String>> userBehaviorVideoMap = param.getBehaviorVideos();
|
|
|
|
|
+ Map<String, String> creativeInfo = param.getCreativeInfoFeature();
|
|
|
|
|
|
|
|
// 3. 特征处理
|
|
// 3. 特征处理
|
|
|
List<RankItem> rankItems = CommonCollectionUtils.toList(rovRecallRank, RankItem::new);
|
|
List<RankItem> rankItems = CommonCollectionUtils.toList(rovRecallRank, RankItem::new);
|
|
|
- Map<String, Float> userFeatureMap = getUserFeature(currentMs, param, headVideoInfo, userProfile, featureOriginUser);
|
|
|
|
|
- batchGetVideoFeature(currentMs, userProfile, headVideoInfo, videoBaseInfoMap,
|
|
|
|
|
|
|
+ Map<String, Float> userFeatureMap = getUserFeature(currentMs, param, creativeInfo, headVideoInfo, userProfile, featureOriginUser);
|
|
|
|
|
+ batchGetVideoFeature(currentMs, userProfile, creativeInfo, headVideoInfo, videoBaseInfoMap,
|
|
|
newC7Map, newC8Map, featureOriginUser, userBehaviorVideoMap, featureOriginVideo, rankItems);
|
|
newC7Map, newC8Map, featureOriginUser, userBehaviorVideoMap, featureOriginVideo, rankItems);
|
|
|
|
|
|
|
|
// 4. 排序模型计算
|
|
// 4. 排序模型计算
|
|
|
Map<String, Float> sceneFeatureMap = new HashMap<>(0);
|
|
Map<String, Float> sceneFeatureMap = new HashMap<>(0);
|
|
|
- List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_fm_xgb_20250317.conf").scoring(sceneFeatureMap, userFeatureMap, userFeatureMap, rankItems);
|
|
|
|
|
|
|
+ List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_fm_xgb_20260116.conf").scoring(sceneFeatureMap, userFeatureMap, userFeatureMap, rankItems);
|
|
|
|
|
|
|
|
// 5. 排序公式特征
|
|
// 5. 排序公式特征
|
|
|
double xgbRovNegRate = mergeWeight.getOrDefault("xgbRovNegRate", 0.059);
|
|
double xgbRovNegRate = mergeWeight.getOrDefault("xgbRovNegRate", 0.059);
|
|
@@ -146,7 +149,7 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
|
|
|
item.getScoresMap().put("scoreCoefficient", scoreCoefficient);
|
|
item.getScoresMap().put("scoreCoefficient", scoreCoefficient);
|
|
|
item.getScoresMap().put("cate2CoefficientDenominator", cate2CoefficientDenominator);
|
|
item.getScoresMap().put("cate2CoefficientDenominator", cate2CoefficientDenominator);
|
|
|
|
|
|
|
|
- score = fmRov * (0.1 + newNorXGBScore) * (0.1 + vor) * (1 + scoreCoefficient / cate2CoefficientDenominator);
|
|
|
|
|
|
|
+ score = fmRov * (0.1 + hasReturnRovScore) * (0.1 + vor) * (1 + scoreCoefficient / cate2CoefficientDenominator);
|
|
|
|
|
|
|
|
Video video = item.getVideo();
|
|
Video video = item.getVideo();
|
|
|
video.setScore(score);
|
|
video.setScore(score);
|
|
@@ -204,42 +207,13 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private Map<String, Map<String, String>> getUserBehaviorVideoMap(UserShareReturnProfile userProfile) {
|
|
|
|
|
- Set<String> vidSet = new HashSet<>();
|
|
|
|
|
- if (null != userProfile) {
|
|
|
|
|
- for (List<UserSRBO> list : Arrays.asList(userProfile.getM_s_s(), userProfile.getM_r_s(), userProfile.getL_s_s(), userProfile.getL_r_s())) {
|
|
|
|
|
- if (null != list) {
|
|
|
|
|
- for (UserSRBO u : list) {
|
|
|
|
|
- if (null != u) {
|
|
|
|
|
- vidSet.add(u.getId() + "");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Map<String, Map<String, String>> historyVideoMap = new HashMap<>();
|
|
|
|
|
- if (!vidSet.isEmpty()) {
|
|
|
|
|
- Map<String, Map<String, Map<String, String>>> videoMap = featureService.getVideoBaseInfo("", new ArrayList<>(vidSet));
|
|
|
|
|
- if (null != videoMap && !videoMap.isEmpty()) {
|
|
|
|
|
- for (Map.Entry<String, Map<String, Map<String, String>>> entry : videoMap.entrySet()) {
|
|
|
|
|
- String vid = entry.getKey();
|
|
|
|
|
- Map<String, Map<String, String>> map = entry.getValue();
|
|
|
|
|
- if (null != map && map.containsKey("alg_vid_feature_basic_info")) {
|
|
|
|
|
- historyVideoMap.put(vid, map.get("alg_vid_feature_basic_info"));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return historyVideoMap;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private Map<String, Float> getUserFeature(long currentMs, RankParam param, Map<String, String> headInfo, UserShareReturnProfile userProfile, Map<String, Map<String, String>> userOriginInfo) {
|
|
|
|
|
|
|
+ private Map<String, Float> getUserFeature(long currentMs, RankParam param, Map<String, String> creativeInfo, Map<String, String> headInfo, UserShareReturnProfile userProfile, Map<String, Map<String, String>> userOriginInfo) {
|
|
|
Map<String, Double> featMap = new HashMap<>();
|
|
Map<String, Double> featMap = new HashMap<>();
|
|
|
// context feature
|
|
// context feature
|
|
|
String appType = String.valueOf(param.getAppType());
|
|
String appType = String.valueOf(param.getAppType());
|
|
|
String hotSceneType = String.valueOf(param.getHotSceneType());
|
|
String hotSceneType = String.valueOf(param.getHotSceneType());
|
|
|
FeatureV6.getContextFeature(currentMs, appType, hotSceneType, featMap);
|
|
FeatureV6.getContextFeature(currentMs, appType, hotSceneType, featMap);
|
|
|
|
|
+ FeatureV6.getCreativeBaseFeature("e1", creativeInfo, featMap);
|
|
|
|
|
|
|
|
// head video feature
|
|
// head video feature
|
|
|
FeatureV6.getVideoBaseFeature("h", currentMs, headInfo, featMap);
|
|
FeatureV6.getVideoBaseFeature("h", currentMs, headInfo, featMap);
|
|
@@ -254,6 +228,7 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
|
|
|
|
|
|
|
|
private Map<String, Float> getVideoFeature(long currentMs, String vid,
|
|
private Map<String, Float> getVideoFeature(long currentMs, String vid,
|
|
|
UserShareReturnProfile userProfile,
|
|
UserShareReturnProfile userProfile,
|
|
|
|
|
+ Map<String, String> creativeInfo,
|
|
|
Map<String, String> headInfo, Map<String, String> rankInfo,
|
|
Map<String, String> headInfo, Map<String, String> rankInfo,
|
|
|
Map<String, Map<String, String[]>> c7Map,
|
|
Map<String, Map<String, String[]>> c7Map,
|
|
|
Map<String, Map<String, String[]>> c8Map,
|
|
Map<String, Map<String, String[]>> c8Map,
|
|
@@ -273,6 +248,7 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
|
|
|
|
|
|
|
|
// head&rank cross feature
|
|
// head&rank cross feature
|
|
|
FeatureV6.getHeadRankVideoCrossFeature(headInfo, rankInfo, featMap);
|
|
FeatureV6.getHeadRankVideoCrossFeature(headInfo, rankInfo, featMap);
|
|
|
|
|
+ FeatureV6.getCreativeCrossFeature("e1", creativeInfo, rankInfo, featMap);
|
|
|
|
|
|
|
|
// user profile & rank cross
|
|
// user profile & rank cross
|
|
|
FeatureV6.getProfileVideoCrossFeature(currentMs, userProfile, rankInfo, historyVideoMap, featMap);
|
|
FeatureV6.getProfileVideoCrossFeature(currentMs, userProfile, rankInfo, historyVideoMap, featMap);
|
|
@@ -282,6 +258,7 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
|
|
|
|
|
|
|
|
private void batchGetVideoFeature(long currentMs,
|
|
private void batchGetVideoFeature(long currentMs,
|
|
|
UserShareReturnProfile userProfile,
|
|
UserShareReturnProfile userProfile,
|
|
|
|
|
+ Map<String, String> creativeInfo,
|
|
|
Map<String, String> headInfo,
|
|
Map<String, String> headInfo,
|
|
|
Map<String, Map<String, Map<String, String>>> videoBaseInfoMap,
|
|
Map<String, Map<String, Map<String, String>>> videoBaseInfoMap,
|
|
|
Map<String, Map<String, String[]>> c7Map,
|
|
Map<String, Map<String, String[]>> c7Map,
|
|
@@ -296,7 +273,7 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
|
|
|
String vid = item.getVideoId() + "";
|
|
String vid = item.getVideoId() + "";
|
|
|
Map<String, String> rankInfo = videoBaseInfoMap.getOrDefault(vid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
|
|
Map<String, String> rankInfo = videoBaseInfoMap.getOrDefault(vid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
|
|
|
Future<Integer> future = ThreadPoolFactory.defaultPool().submit(() -> {
|
|
Future<Integer> future = ThreadPoolFactory.defaultPool().submit(() -> {
|
|
|
- item.featureMap = getVideoFeature(currentMs, vid, userProfile, headInfo, rankInfo, c7Map, c8Map, userOriginInfo, historyVideoMap, videoOriginInfo);
|
|
|
|
|
|
|
+ item.featureMap = getVideoFeature(currentMs, vid, userProfile, creativeInfo, headInfo, rankInfo, c7Map, c8Map, userOriginInfo, historyVideoMap, videoOriginInfo);
|
|
|
item.norFeatureMap = item.featureMap;
|
|
item.norFeatureMap = item.featureMap;
|
|
|
return 1;
|
|
return 1;
|
|
|
});
|
|
});
|