|
@@ -63,19 +63,6 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
this.initSparseFeatureNames();
|
|
|
}
|
|
|
|
|
|
- private static final List<String> hasChannelScenes = new ArrayList<String>() {{
|
|
|
- add("DaiTou");
|
|
|
- add("GzhTouLiu");
|
|
|
- add("daitou");
|
|
|
- add("dyyjs");
|
|
|
- add("dyyqw");
|
|
|
- add("fwhdyy");
|
|
|
- add("gzhhz");
|
|
|
- add("gzhhzzx");
|
|
|
- add("shequn");
|
|
|
- add("touliu");
|
|
|
- add("xcxdt");
|
|
|
- }};
|
|
|
|
|
|
@Override
|
|
|
public List<AdRankItem> adItemRank(RankRecommendRequestParam request, ScoreParam scoreParam) {
|
|
@@ -97,10 +84,12 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
// feature1
|
|
|
Feature feature = this.getFeature(scoreParam, request);
|
|
|
|
|
|
+
|
|
|
Map<String, Map<String, String>> userFeature = feature.getUserFeature();
|
|
|
Map<String, Map<String, String>> videoFeature = feature.getVideoFeature();
|
|
|
Map<String, Map<String, Map<String, String>>> allAdVerFeature = feature.getAdVerFeature();
|
|
|
Map<String, Map<String, Map<String, String>>> allCidFeature = feature.getCidFeature();
|
|
|
+ Map<String, String> reqFeature = this.getReqFeature(scoreParam, request);
|
|
|
|
|
|
Map<String, String> userFeatureMap = new HashMap<>();
|
|
|
Map<String, String> c1Feature = userFeature.getOrDefault("alg_mid_feature_ad_action", new HashMap<>());
|
|
@@ -121,13 +110,16 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
Map<String, String> g2Feature = userFeature.getOrDefault("mid_share_video_cate", new HashMap<>());
|
|
|
|
|
|
|
|
|
- userFeatureMap.put("brand", scoreParam.getRequestContext().getMachineinfoBrand().equalsIgnoreCase("-1") ?
|
|
|
- "" : scoreParam.getRequestContext().getMachineinfoBrand().toUpperCase());
|
|
|
- userFeatureMap.put("region", Objects.equals(scoreParam.getRequestContext().getRegion(), "-1") ?
|
|
|
- "" : scoreParam.getRequestContext().getRegion());
|
|
|
- userFeatureMap.put("city", Objects.equals(scoreParam.getRequestContext().getCity(), "-1") ?
|
|
|
- "" : scoreParam.getRequestContext().getCity());
|
|
|
- userFeatureMap.put("vid", String.valueOf(request.getVideoId()));
|
|
|
+ userFeatureMap.put("brand", reqFeature.getOrDefault("brand", ""));
|
|
|
+ userFeatureMap.put("region", reqFeature.getOrDefault("region", ""));
|
|
|
+ userFeatureMap.put("city", reqFeature.getOrDefault("city", ""));
|
|
|
+ userFeatureMap.put("vid", reqFeature.getOrDefault("vid", ""));
|
|
|
+ userFeatureMap.put("apptype", reqFeature.getOrDefault("apptype", ""));
|
|
|
+ userFeatureMap.put("is_first_layer", reqFeature.getOrDefault("is_first_layer", ""));
|
|
|
+ userFeatureMap.put("root_source_scene", reqFeature.getOrDefault("root_source_scene", ""));
|
|
|
+ userFeatureMap.put("root_source_channel", reqFeature.getOrDefault("root_source_channel", ""));
|
|
|
+
|
|
|
+
|
|
|
userFeatureMap.put("cate1", d3Feature.get("merge_first_level_cate"));
|
|
|
userFeatureMap.put("cate2", d3Feature.get("merge_second_level_cate"));
|
|
|
userFeatureMap.put("user_vid_return_tags_2h", e1Feature.getOrDefault("tags_2h", null));
|
|
@@ -143,29 +135,6 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
userFeatureMap.put("user_vid_share_cate1_14d", g2Feature.getOrDefault("cate1_14d", null));
|
|
|
userFeatureMap.put("user_vid_share_cate2_14d", g2Feature.getOrDefault("cate2_14d", null));
|
|
|
|
|
|
- if (request.getAppType() != null) {
|
|
|
- userFeatureMap.put("apptype", String.valueOf(request.getAppType()));
|
|
|
- }
|
|
|
-
|
|
|
- String rootSessionId = request.getRootSessionId();
|
|
|
- String sessionId = request.getSessionId();
|
|
|
- String subSessionId = request.getSubSessionId();
|
|
|
- String rootSourceId = request.getRootSourceId();
|
|
|
- int isFirstLayer;
|
|
|
- if (Objects.equals(rootSessionId, subSessionId) || Objects.equals(rootSessionId, sessionId)) {
|
|
|
- isFirstLayer = 1;
|
|
|
- } else {
|
|
|
- isFirstLayer = 2;
|
|
|
- }
|
|
|
- userFeatureMap.put("is_first_layer", String.valueOf(isFirstLayer));
|
|
|
- if (StringUtils.isNotEmpty(rootSourceId)) {
|
|
|
- String rootSourceScene = rootSourceId.split("_")[0];
|
|
|
- userFeatureMap.put("root_source_scene", rootSourceScene);
|
|
|
- if (hasChannelScenes.contains(rootSourceScene) && rootSourceId.split("_").length > 1) {
|
|
|
- String rootSourceChannel = rootSourceId.split("_")[1];
|
|
|
- userFeatureMap.put("root_source_channel", rootSourceChannel);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
|
|
|
long time1 = System.currentTimeMillis();
|
|
@@ -354,6 +323,8 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
top1Item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
+ top1Item.getMetaFeatureMap().put("reqFeature", reqFeature);
|
|
|
+ top1Item.getMetaFeatureMap().put("sceneFeature", sceneFeatureMap);
|
|
|
}
|
|
|
long time6 = System.currentTimeMillis();
|
|
|
log.info("cost={}, getFeature={}, handleFeature={}, similar={}, bucketFeature={}, getScorerPipeline={}, " +
|
|
@@ -693,15 +664,6 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
return vidRankMaps;
|
|
|
}
|
|
|
|
|
|
- public Map<String, String> handleSceneFeature(long ts) {
|
|
|
- Map<String, String> sceneFeatureMap = new HashMap<>();
|
|
|
- sceneFeatureMap.put("hour_" + DateUtils.getHourByTimestamp(ts), "0.1");
|
|
|
- sceneFeatureMap.put("dayofweek_" + DateUtils.getDayOrWeekByTimestamp(ts), "0.1");
|
|
|
- sceneFeatureMap.put("hour", String.valueOf(DateUtils.getHourByTimestamp(ts)));
|
|
|
- sceneFeatureMap.put("hour_quarter", String.valueOf(DateUtils.getHourQuarter(ts)));
|
|
|
- return sceneFeatureMap;
|
|
|
- }
|
|
|
-
|
|
|
private void readBucketFile() {
|
|
|
if (MapUtils.isNotEmpty(bucketsMap)) {
|
|
|
return;
|