jch преди 4 месеца
родител
ревизия
2fc94475a4

+ 136 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/FeatureService.java

@@ -1,5 +1,6 @@
 package com.tzld.piaoquan.recommend.server.service;
 
+import com.google.common.collect.ImmutableMap;
 import com.google.common.reflect.TypeToken;
 import com.tzld.piaoquan.recommend.feature.model.feature.FeatureKeyProto;
 import com.tzld.piaoquan.recommend.server.remote.FeatureV2RemoteService;
@@ -22,6 +23,8 @@ public class FeatureService {
     @Autowired
     private FeatureV2RemoteService remoteService;
 
+    private static final Set<String> hotSceneSet = new HashSet<>(Arrays.asList("1008", "1007", "1058", "1074", "1010"));
+
     /**
      * @return k1:视频、k2:表、k3:特征、v:特征值
      */
@@ -120,8 +123,131 @@ public class FeatureService {
         return feature;
     }
 
+
+    public Map<String, Map<String, Map<String, String>>> getVideoBaseInfo(String headVid, List<String> vidList) {
+        List<FeatureKeyProto> protos = new ArrayList<>();
+        if (null != headVid && !headVid.isEmpty()) {
+            protos.add(genWithKeyMap("alg_vid_feature_basic_info", headVid, ImmutableMap.of("vid", headVid)));
+        }
+        for (String vid : vidList) {
+            protos.add(genWithKeyMap("alg_vid_feature_basic_info", vid, ImmutableMap.of("vid", vid)));
+        }
+        Feature feature = getFeatureByProto(protos);
+        return feature.getVideoFeature();
+    }
+
+    public Feature getNewFeature(String province, String mid, String sceneType, String headVid,
+                                 Map<String, Map<String, Map<String, String>>> videoBaseInfoMap, List<String> vidList) {
+        List<FeatureKeyProto> protos = new ArrayList<>();
+        String i2iSceneType = "other";
+        if (hotSceneSet.contains(sceneType)) {
+            i2iSceneType = sceneType;
+        }
+        for (String vid : vidList) {
+            // ********************* old vid ******************
+            protos.add(genWithVid("alg_vid_feature_all_exp_v2", vid));
+            protos.add(genWithVid("alg_vid_feature_all_share", vid));
+            protos.add(genWithVid("alg_vid_feature_all_return", vid));
+            protos.add(genWithVid("alg_vid_feature_exp2share_v2", vid));
+            protos.add(genWithVid("alg_vid_feature_share2return", vid));
+            protos.add(genWithVid("alg_vid_feature_feed_noflow_exp_v2", vid));
+            protos.add(genWithVid("alg_vid_feature_feed_noflow_root_share_v2", vid));
+            protos.add(genWithVid("alg_vid_feature_feed_noflow_root_return_v2", vid));
+            protos.add(genWithVid("alg_vid_feature_feed_flow_exp_v2", vid));
+            protos.add(genWithVid("alg_vid_feature_feed_flow_root_share_v2", vid));
+            protos.add(genWithVid("alg_vid_feature_feed_flow_root_return_v2", vid));
+
+            // vid + province
+            protos.add(genWithVidAndProvince("alg_vid_feature_feed_province_exp_v2", vid, province));
+            protos.add(genWithVidAndProvince("alg_vid_feature_feed_province_root_share_v2", vid, province));
+            protos.add(genWithVidAndProvince("alg_vid_feature_feed_province_root_return_v2", vid, province));
+
+            // headvid + vid
+            protos.add(genWithKeyMap("alg_recsys_feature_cf_i2i_new_v2", vid, ImmutableMap.of("vid_a", headVid, "vid_b", vid)));
+
+            // ********************* new vid ******************
+            protos.add(genWithKeyMap("alg_vid_feature_day", vid, ImmutableMap.of("vid", vid)));
+            protos.add(genWithKeyMap("alg_sence_type_feature", vid, ImmutableMap.of("sence_type", sceneType, "videoid", vid)));
+            protos.add(genWithKeyMap("alg_recsys_feature_cf_i2i_scene_rov", vid, ImmutableMap.of("sence_type", i2iSceneType, "vid_a", headVid, "vid_b", vid)));
+            protos.add(genWithKeyMap("alg_recsys_feature_cf_i2i_scene_ros", vid, ImmutableMap.of("sence_type", i2iSceneType, "vid_a", headVid, "vid_b", vid)));
+            protos.add(genWithKeyMap("alg_recsys_feature_weak_cf_i2i_scene_rov", vid, ImmutableMap.of("sence_type", i2iSceneType, "vid_a", headVid, "vid_b", vid)));
+            protos.add(genWithKeyMap("alg_recsys_feature_weak_cf_i2i_scene_ros", vid, ImmutableMap.of("sence_type", i2iSceneType, "vid_a", headVid, "vid_b", vid)));
+            if (null != videoBaseInfoMap && videoBaseInfoMap.containsKey(vid)) {
+                Map<String, Map<String, String>> videoInfo = videoBaseInfoMap.get(vid);
+                if (null != videoInfo && videoInfo.containsKey("alg_vid_feature_basic_info")) {
+                    Map<String, String> baseInfo = videoInfo.get("alg_vid_feature_basic_info");
+                    if (null != baseInfo) {
+                        String cate1 = baseInfo.get("cate1_list");
+                        if (null != cate1 && !cate1.isEmpty()) {
+                            protos.add(genWithKeyMap("alg_cate1_feature", vid, ImmutableMap.of("cate1", cate1)));
+                            protos.add(genWithKeyMap("alg_cate1_feature_day", vid, ImmutableMap.of("cate1", cate1)));
+                        }
+                        String cate2 = baseInfo.get("cate2");
+                        if (null != cate2 && !cate2.isEmpty()) {
+                            protos.add(genWithKeyMap("alg_cate2_feature", vid, ImmutableMap.of("cate2", cate2)));
+                            protos.add(genWithKeyMap("alg_cate2_feature_day", vid, ImmutableMap.of("cate2", cate2)));
+                        }
+                        String vidSource = baseInfo.get("vid_source");
+                        if (null != vidSource && !vidSource.isEmpty()) {
+                            protos.add(genWithKeyMap("alg_vid_source_feature", vid, ImmutableMap.of("vid_source", vidSource)));
+                            protos.add(genWithKeyMap("alg_video_source_feature_day", vid, ImmutableMap.of("video_source", vidSource)));
+                        }
+                        String videoUnionid = baseInfo.get("title_time_w_h_unionid");
+                        if (null != videoUnionid && !videoUnionid.isEmpty()) {
+                            protos.add(genWithKeyMap("alg_video_unionid_feature_day", vid, ImmutableMap.of("video_unionid", videoUnionid)));
+                        }
+                    }
+                }
+            }
+        }
+
+        // user
+        protos.add(genWithMid("alg_mid_feature_play", mid));
+        protos.add(genWithMid("alg_mid_feature_share_and_return", mid));
+        protos.add(genWithMid("alg_mid_feature_play_tags", mid));
+        protos.add(genWithMid("alg_mid_feature_return_tags", mid));
+        protos.add(genWithMid("alg_mid_feature_share_tags", mid));
+        protos.add(genWithMid("alg_mid_feature_feed_exp_share_tags_v2", mid));
+        protos.add(genWithMid("alg_mid_feature_feed_exp_return_tags_v2", mid));
+        protos.add(genWithMid("alg_mid_feature_sharecf", mid));
+        protos.add(genWithMid("alg_mid_feature_returncf", mid));
+
+        return getFeatureByProto(protos);
+    }
+
+    private Feature getFeatureByProto(List<FeatureKeyProto> protos) {
+        Map<String, String> result = remoteService.getFeature(protos);
+        Feature feature = new Feature();
+        result.entrySet().forEach(e -> {
+            String[] uk = StringUtils.split(e.getKey(), ":");
+            String prefix = uk[0];
+            String table = uk[1];
+            Map<String, String> colMap = JSONUtils.fromJson(e.getValue(), new TypeToken<Map<String, String>>() {
+            }, Collections.emptyMap());
+
+            String featureStr = colMap.get("feature");
+            switch (prefix) {
+                case "v":
+                    String vid = uk[2];
+                    Map<String, Map<String, String>> tableFeatureMap = feature.getVideoFeature().getOrDefault(vid, new HashMap<>());
+                    tableFeatureMap.put(table, JSONUtils.fromJson(featureStr, new TypeToken<Map<String, String>>() {
+                    }, Collections.emptyMap()));
+                    feature.getVideoFeature().put(vid, tableFeatureMap);
+                    break;
+                case "u":
+                    feature.getUserFeature().put(table, JSONUtils.fromJson(featureStr, new TypeToken<Map<String, String>>() {
+                    }, Collections.emptyMap()));
+                    break;
+                default:
+                    break;
+            }
+        });
+        return feature;
+    }
+
     private final String videoUkFormat = "v:%s:%s";
     private final String userUkFormat = "u:%s";
+    private final String kvUkFormat = "v:%s:%s";
 
     private FeatureKeyProto genWithVid(String table, String vid) {
         return FeatureKeyProto.newBuilder()
@@ -166,6 +292,16 @@ public class FeatureService {
                 .build();
     }
 
+    private FeatureKeyProto genWithKeyMap(String table, String uniqKey, Map<String, String> map) {
+        FeatureKeyProto.Builder builder = FeatureKeyProto.newBuilder()
+                .setUniqueKey(String.format(kvUkFormat, table, uniqKey))
+                .setTableName(table);
+        for (Map.Entry<String, String> entry : map.entrySet()) {
+            builder.putFieldValue(entry.getKey(), entry.getValue());
+        }
+        return builder.build();
+    }
+
     @Data
     public static class Feature {
         // k1:视频、k2:表、k3:特征、v:特征值

+ 1 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/RecommendService.java

@@ -624,6 +624,7 @@ public class RecommendService {
         rankParam.setExpIdMap(param.getExpIdMap());
         rankParam.setCategoryId(param.getCategoryId());
         rankParam.setHeadVid(param.getVideoId());
+        rankParam.setHotSceneType(param.getHotSceneType());
         return rankParam;
     }
 

+ 1 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/RankParam.java

@@ -26,6 +26,7 @@ public class RankParam {
     private MachineInfo machineInfo;
     private Set<String> abExpCodes;
     private Long headVid=0L;
+    private Long hotSceneType=0L;
 
     // 层 - 实验
     private Map<String, String> expIdMap;

+ 12 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/strategy/RankStrategy4RegionMergeModelBasic.java

@@ -340,6 +340,18 @@ public class RankStrategy4RegionMergeModelBasic extends RankService {
 
     }
 
+    static class Tuple3 {
+        public String first;
+        public List<String> second;
+        public Map<String, String> third;
+
+        public Tuple3(String first, List<String> second, Map<String, String> third) {
+            this.first = first;
+            this.second = second;
+            this.third = third;
+        }
+    }
+
     static class Tuple2 {
         public Map<String, String> first;
 

+ 128 - 61
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/strategy/RankStrategy4RegionMergeModelV564.java

@@ -9,8 +9,8 @@ import com.tzld.piaoquan.recommend.server.service.rank.RankParam;
 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.score.ScorerUtils;
-import com.tzld.piaoquan.recommend.server.service.score.VovH24Weight562Scorer;
 import com.tzld.piaoquan.recommend.server.util.CommonCollectionUtils;
+import com.tzld.piaoquan.recommend.server.util.SimilarityUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.math3.util.Pair;
@@ -29,23 +29,23 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
     @ApolloJsonValue("${rank.score.merge.weightv564:}")
     private Map<String, Double> mergeWeight;
 
-    @ApolloJsonValue("${rank.score.merge.weightv562:}")
-    private Map<String, Double> mergeWeight562;
-
-    @ApolloJsonValue("${rank.score.merge.weightv567:}")
-    private Map<String, Double> mergeWeight567;
-
     @Autowired
     private FeatureService featureService;
 
+
     @Value("${similarity.concurrent: true}")
     private boolean similarityConcurrent;
 
+    private static final List<String> shortPeriod = Arrays.asList("1h", "2h", "4h", "6h", "12h", "24h", "7d");
+    private static final List<String> middlePeriod = Arrays.asList("14d", "30d");
+    private static final List<String> longPeriod = Arrays.asList("7d", "35d", "90d", "365d");
+    private static final List<String> cfRosList = Collections.singletonList("rosn");
+    private static final List<String> cfRovList = Collections.singletonList("rovn");
+    private static final List<String> videoSimAttrs = Arrays.asList("cate2", "cate1_list", "keywords");
+
     @Override
     public List<Video> mergeAndRankRovRecall(RankParam param) {
         Map<String, Double> mergeWeight = this.mergeWeight != null ? this.mergeWeight : new HashMap<>(0);
-        Map<String, Double> mergeWeight562 = this.mergeWeight562 != null ? this.mergeWeight562 : new HashMap<>(0);
-        Map<String, Double> mergeWeight567 = this.mergeWeight567 != null ? this.mergeWeight567 : new HashMap<>(0);
         //-------------------融-------------------
         //-------------------合-------------------
         //-------------------逻-------------------
@@ -90,11 +90,12 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
         // k1:视频、k2:表、k3:特征、v:特征值
         String provinceCn = param.getProvince().replaceAll("省$", "");
         String headVid = String.valueOf(param.getHeadVid());
-        FeatureService.Feature feature = featureService.getFeature(param.getMid(), vids,
-                String.valueOf(param.getAppType()), provinceCn, headVid);
+        String sceneType = String.valueOf(param.getHotSceneType());
+        Map<String, Map<String, Map<String, String>>> videoBaseInfoMap = featureService.getVideoBaseInfo(headVid, vids);
+        FeatureService.Feature feature = featureService.getNewFeature(provinceCn, param.getMid(), sceneType, headVid, videoBaseInfoMap, vids);
         Map<String, Map<String, String>> featureOriginUser = feature.getUserFeature();
         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 特征处理
         Map<String, Double> userFeatureMapDouble = new HashMap<>();
@@ -225,7 +226,7 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
                 }
             }
 
-            Map<String, String> videoInfo = featureOriginVideo.getOrDefault(vid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
+            Map<String, String> videoInfo = videoBaseInfoMap.getOrDefault(vid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
             featureMap.put("total_time", Double.parseDouble(videoInfo.getOrDefault("total_time", "0")));
             featureMap.put("bit_rate", Double.parseDouble(videoInfo.getOrDefault("bit_rate", "0")));
 
@@ -303,6 +304,11 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
                 featureMap.put("d1_return_n", Double.parseDouble(d1.getOrDefault("return_n", "0")));
                 featureMap.put("d1_rovn", Double.parseDouble(d1.getOrDefault("rovn", "0")));
             }
+            // ******************** new feature ********************
+            addVideoStatFeature(vid, featureOriginVideo, featureMap);
+            addVideoCFFeature(vid, featureOriginVideo, featureMap);
+            addVideoSimFeature(headVideoInfo, videoInfo, featureMap);
+
             item.featureMapDouble = featureMap;
         }
 
@@ -320,7 +326,6 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
                 userFeatureMap.put(name, String.valueOf(scoreNew));
             }
         }
-
         for (RankItem item : rankItems) {
             Map<String, String> featureMap = new HashMap<>();
             Map<String, Double> featureMapDouble = item.featureMapDouble;
@@ -338,70 +343,35 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
             }
             item.featureMap = featureMap;
         }
-
-
-        // vovh24特征
-        String partition = redisTemplate.opsForValue().get("redis:vid_vovh24pred_time:partition");
-        Map<String, Map<String, String>> vid2VovFeatureMap = this.getVideoRedisFeature(vids, "redis:vid_vovh24pred_time:" + partition + ":");
-        for (RankItem rankItem : rankItems) {
-            if (vid2VovFeatureMap.containsKey(String.valueOf(rankItem.getVideoId()))) {
-                rankItem.getFeatureMap().putAll(vid2VovFeatureMap.get(String.valueOf(rankItem.getVideoId())));
-            }
-        }
-
         // 4 排序模型计算
         Map<String, String> sceneFeatureMap = new HashMap<>(0);
-        if (null != partition && partition.length() > 2) {
-            sceneFeatureMap.put("weightKey", partition.substring(partition.length() - 2));
-        }
-        List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_20241119.conf").scoring(sceneFeatureMap, userFeatureMap, rankItems);
-
-        // 562 vovScore
-        Map<String, Map<String, String>> vov562FeatureMap = this.getVideoRedisFeature(vids, "redis:vid_vovhour4rank:");
-        VovH24Weight562Scorer.scoring(mergeWeight562, vov562FeatureMap, items);
-
+        List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_20240807.conf").scoring(sceneFeatureMap, userFeatureMap, rankItems);
         // 5 排序公式特征
-        Map<String, Map<String, String>> vid2MapFeature = this.getVideoRedisFeature(vids, "redis:vid_hasreturn_rov:");
-        double alpha_vov = mergeWeight.getOrDefault("alpha_vov", 0.2);
-        double alpha_vov_562 = mergeWeight562.getOrDefault("alpha_vov", 1.0);
-        double alpha_vov_567 = mergeWeight567.getOrDefault("alpha_vov", 0.05);
-        double func = mergeWeight.getOrDefault("func", 1.0);
+        Map<String, Map<String, String>> vid2MapFeature = this.getVideoRedisFeature(vids, "redis:vid_hasreturn_vor:");
         List<Video> result = new ArrayList<>();
         for (RankItem item : items) {
-            item.getScoresMap().put("alpha_vov", alpha_vov);
-            double score = 0.0;
+            double score;
             double fmRovOrigin = item.getScoreRov();
             item.getScoresMap().put("fmRovOrigin", fmRovOrigin);
             double fmRov = restoreScore(fmRovOrigin);
             item.getScoresMap().put("fmRov", fmRov);
-            double hasReturnRovScore = Double.parseDouble(vid2MapFeature.getOrDefault(item.getVideoId() + "", new HashMap<>()).getOrDefault("rate_n", "0"));
+            double hasReturnRovScore = Double.parseDouble(vid2MapFeature.getOrDefault(item.getVideoId() + "", new HashMap<>()).getOrDefault("rov", "0"));
             item.getScoresMap().put("hasReturnRovScore", hasReturnRovScore);
-            double vovScore = item.getVovScore();
-            item.getScoresMap().put("vovScore", vovScore);
-            if (func == 1) {
-                score = fmRov * (1 + hasReturnRovScore) + alpha_vov * vovScore;
-            } else {
-                score = fmRov * (1 + hasReturnRovScore) * (1.0 + alpha_vov * vovScore);
-            }
-
-            // 562 && 567
-            double score562 = fmRov * (1 + hasReturnRovScore) * (1.0 + alpha_vov_562 * item.getScoresMap().getOrDefault("vovScore562", 0d));
-            double score567 = fmRov * (1 + hasReturnRovScore) + alpha_vov_567 * item.getScoresMap().getOrDefault("vovScore567", 0d);
-            item.getScoresMap().put("score562", score562);
-            item.getScoresMap().put("score567", score567);
-
+            double vor = Double.parseDouble(vid2MapFeature.getOrDefault(item.getVideoId() + "", new HashMap<>()).getOrDefault("vor", "0"));
+            item.getScoresMap().put("vor", vor);
+            score = fmRov * (0.1 + hasReturnRovScore) * (0.1 + vor);
             Video video = item.getVideo();
             video.setScore(score);
             video.setSortScore(score);
             video.setScoresMap(item.getScoresMap());
             video.setAllFeatureMap(item.getAllFeatureMap());
-            if (feature != null
-                    && MapUtils.isNotEmpty(feature.getVideoFeature())
-                    && MapUtils.isNotEmpty(feature.getVideoFeature().get(item.getVideoId() + ""))) {
+            if (MapUtils.isNotEmpty(feature.getVideoFeature()) && MapUtils.isNotEmpty(feature.getVideoFeature().get(item.getVideoId() + ""))) {
                 video.getMetaFeatureMap().putAll(feature.getVideoFeature().get(item.getVideoId() + ""));
             }
-            if (feature != null
-                    && MapUtils.isNotEmpty(feature.getUserFeature())) {
+            if (MapUtils.isNotEmpty(videoBaseInfoMap) && MapUtils.isNotEmpty(videoBaseInfoMap.get(item.getVideoId() + ""))) {
+                video.getMetaFeatureMap().putAll(videoBaseInfoMap.get(item.getVideoId() + ""));
+            }
+            if (MapUtils.isNotEmpty(feature.getUserFeature())) {
                 video.getMetaFeatureMap().putAll(feature.getUserFeature());
             }
             result.add(video);
@@ -409,4 +379,101 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
         result.sort(Comparator.comparingDouble(o -> -o.getSortScore()));
         return result;
     }
+
+    private Map<String, String> getVideoOneTypeInfo(String vid, String name,
+                                                    Map<String, Map<String, Map<String, String>>> videoAllInfoMap) {
+        if (null == videoAllInfoMap) {
+            return new HashMap<>();
+        }
+        return videoAllInfoMap.getOrDefault(vid, new HashMap<>()).getOrDefault(name, new HashMap<>());
+    }
+
+    private double getVideoOneInfo(String name, Map<String, String> infoMap) {
+        if (null == infoMap) {
+            return 0.0;
+        }
+        return infoMap.isEmpty() ? 0 : Double.parseDouble(infoMap.getOrDefault(name, "0.0"));
+    }
+
+    private void addVideoStatFeature(String vid, Map<String, Map<String, Map<String, String>>> videoAllInfoMap,
+                                     Map<String, Double> featureMap) {
+        List<Tuple3> vidStatInfo = Arrays.asList(
+                new Tuple3("b20", shortPeriod, getVideoOneTypeInfo(vid, "alg_cate2_feature", videoAllInfoMap)),
+                new Tuple3("b21", shortPeriod, getVideoOneTypeInfo(vid, "alg_cate1_feature", videoAllInfoMap)),
+                new Tuple3("b22", shortPeriod, getVideoOneTypeInfo(vid, "alg_vid_source_feature", videoAllInfoMap)),
+                new Tuple3("b28", shortPeriod, getVideoOneTypeInfo(vid, "alg_sence_type_feature", videoAllInfoMap)),
+                new Tuple3("b23", middlePeriod, getVideoOneTypeInfo(vid, "alg_cate2_feature_day", videoAllInfoMap)),
+                new Tuple3("b24", middlePeriod, getVideoOneTypeInfo(vid, "alg_cate1_feature_day", videoAllInfoMap)),
+                new Tuple3("b25", middlePeriod, getVideoOneTypeInfo(vid, "alg_video_source_feature_day", videoAllInfoMap)),
+                new Tuple3("b26", longPeriod, getVideoOneTypeInfo(vid, "alg_video_unionid_feature_day", videoAllInfoMap)),
+                new Tuple3("b27", longPeriod, getVideoOneTypeInfo(vid, "alg_vid_feature_day", videoAllInfoMap))
+        );
+        for (Tuple3 tuple3 : vidStatInfo) {
+            String infoType = tuple3.first;
+            List<String> infoPeriod = tuple3.second;
+            Map<String, String> infoMap = tuple3.third;
+            for (String period : infoPeriod) {
+                double share = getVideoOneInfo("share_" + period, infoMap);
+                double return_ = getVideoOneInfo("return_" + period, infoMap);
+                double view_hasreturn = getVideoOneInfo("view_hasreturn_" + period, infoMap);
+                double share_hasreturn = getVideoOneInfo("share_hasreturn_" + period, infoMap);
+                double ros = getVideoOneInfo("ros_" + period, infoMap);
+                double rov = getVideoOneInfo("rov_" + period, infoMap);
+                double r_cnt = getVideoOneInfo("r_cnt_" + period, infoMap);
+                double r_rate = getVideoOneInfo("r_rate_" + period, infoMap);
+                double r_cnt4s = getVideoOneInfo("r_cnt4s_" + period, infoMap);
+                double str = getVideoOneInfo("str_" + period, infoMap);
+
+                featureMap.put(infoType + "_" + period + "_" + "share", ExtractorUtils.calLog(share));
+                featureMap.put(infoType + "_" + period + "_" + "return", ExtractorUtils.calLog(return_));
+                featureMap.put(infoType + "_" + period + "_" + "view_hasreturn", ExtractorUtils.calLog(view_hasreturn));
+                featureMap.put(infoType + "_" + period + "_" + "share_hasreturn", ExtractorUtils.calLog(share_hasreturn));
+                featureMap.put(infoType + "_" + period + "_" + "ros", ros);
+                featureMap.put(infoType + "_" + period + "_" + "rov", rov);
+                featureMap.put(infoType + "_" + period + "_" + "r_cnt", r_cnt);
+                featureMap.put(infoType + "_" + period + "_" + "r_rate", r_rate);
+                featureMap.put(infoType + "_" + period + "_" + "r_cnt4s", r_cnt4s);
+                featureMap.put(infoType + "_" + period + "_" + "str", str);
+            }
+        }
+    }
+
+    private void addVideoCFFeature(String vid, Map<String, Map<String, Map<String, String>>> videoAllInfoMap,
+                                   Map<String, Double> featureMap) {
+        List<Tuple3> vidCFInfo = Arrays.asList(
+                new Tuple3("d2", cfRosList, getVideoOneTypeInfo(vid, "alg_recsys_feature_weak_cf_i2i_scene_ros", videoAllInfoMap)),
+                new Tuple3("d3", cfRosList, getVideoOneTypeInfo(vid, "alg_recsys_feature_cf_i2i_scene_ros", videoAllInfoMap)),
+                new Tuple3("d4", cfRovList, getVideoOneTypeInfo(vid, "alg_recsys_feature_weak_cf_i2i_scene_rov", videoAllInfoMap)),
+                new Tuple3("d5", cfRovList, getVideoOneTypeInfo(vid, "alg_recsys_feature_cf_i2i_scene_rov", videoAllInfoMap))
+        );
+        for (Tuple3 tuple3 : vidCFInfo) {
+            String infoType = tuple3.first;
+            List<String> valTypeList = tuple3.second;
+            Map<String, String> infoMap = tuple3.third;
+            if (!infoMap.isEmpty()) {
+                for (String valType : valTypeList) {
+                    double exp = getVideoOneInfo("exp", infoMap);
+                    double return_n = getVideoOneInfo("return_n", infoMap);
+                    double value = getVideoOneInfo(valType, infoMap);
+
+                    featureMap.put(infoType + "_exp", ExtractorUtils.calLog(exp));
+                    featureMap.put(infoType + "_return_n", ExtractorUtils.calLog(return_n));
+                    featureMap.put(infoType + "_" + valType, value);
+                }
+            }
+        }
+    }
+
+    private void addVideoSimFeature(Map<String, String> headInfo, Map<String, String> rankInfo, Map<String, Double> featureMap) {
+        if (!headInfo.isEmpty() && !rankInfo.isEmpty()) {
+            for (String attr : videoSimAttrs) {
+                String headAttr = headInfo.getOrDefault(attr, "");
+                String rankAttr = rankInfo.getOrDefault(attr, "");
+                if (!"".equals(headAttr) && !"".equals(rankAttr)) {
+                    double simScore = SimilarityUtils.word2VecSimilarity(headAttr, rankAttr);
+                    featureMap.put("video_sim_" + attr, simScore);
+                }
+            }
+        }
+    }
 }