zhaohaipeng 1 mese fa
parent
commit
cddf63754f

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

@@ -3,7 +3,9 @@ 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.model.MachineInfo;
 import com.tzld.piaoquan.recommend.server.remote.FeatureV2RemoteService;
+import com.tzld.piaoquan.recommend.server.service.rank.RankParam;
 import com.tzld.piaoquan.recommend.server.util.JSONUtils;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
@@ -25,6 +27,7 @@ public class FeatureService {
     private FeatureV2RemoteService remoteService;
 
     private static final Set<String> hotSceneSet = new HashSet<>(Arrays.asList("1008", "1007", "1058", "1074", "1010"));
+    private static final Set<String> hotSceneTypeSet = new HashSet<>(Arrays.asList("1008", "1007"));
 
     /**
      * @return k1:视频、k2:表、k3:特征、v:特征值
@@ -217,6 +220,104 @@ public class FeatureService {
         return getFeatureByProto(protos);
     }
 
+    public Feature getFeatureV3(RankParam param, Map<String, Map<String, Map<String, String>>> videoBaseInfoMap, List<String> vidList) {
+        String mid = param.getMid();
+        String headVid = String.valueOf(param.getHeadVid());
+        String province = param.getProvince().replaceAll("省$", "");
+        String apptype = param.getAppType() + "";
+        String orgHotScene = String.valueOf(param.getHotSceneType());
+        String brand = "";
+        if (null != param.getMachineInfo()) {
+            MachineInfo machineInfo = param.getMachineInfo();
+            if (null != machineInfo.getBrand()) {
+                brand = machineInfo.getBrand();
+            }
+        }
+        String hotSceneType = orgHotScene;
+        if (!hotSceneTypeSet.contains(hotSceneType)) {
+            hotSceneType = "other";
+        }
+        String senceType = orgHotScene;
+        if (!hotSceneSet.contains(senceType)) {
+            senceType = "other";
+        }
+
+        List<FeatureKeyProto> protos = new ArrayList<>();
+        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));
+
+            // ********************* new vid ******************
+            protos.add(genWithKeyMap("alg_vid_global_feature_20250212", vid, ImmutableMap.of("vid", vid)));
+            protos.add(genWithKeyMap("alg_vid_recommend_exp_feature_20250212", vid, ImmutableMap.of("vid", vid)));
+            protos.add(genWithKeyMap("alg_vid_recommend_flowpool_exp_feature_20250212", vid, ImmutableMap.of("vid", vid)));
+            // protos.add(genWithKeyMap("alg_vid_long_period_recommend_exp_feature_20250212", vid, ImmutableMap.of("vid", vid)));
+            protos.add(genWithKeyMap("alg_vid_apptype_recommend_exp_feature_20250212", vid, ImmutableMap.of("vid", vid, "apptype", apptype)));
+            protos.add(genWithKeyMap("alg_vid_province_recommend_exp_feature_20250212", vid, ImmutableMap.of("vid", vid, "province", province)));
+            protos.add(genWithKeyMap("alg_vid_brand_recommend_exp_feature_20250212", vid, ImmutableMap.of("vid", vid, "brand", brand)));
+            protos.add(genWithKeyMap("alg_vid_hotsencetype_recommend_exp_feature_20250212", vid, ImmutableMap.of("vid", vid, "hotsencetype", hotSceneType)));
+
+            protos.add(genWithKeyMap("scene_type_vid_cf_feature_20250212", vid, ImmutableMap.of("sence_type", senceType, "vid_a", headVid, "vid_b", vid)));
+            protos.add(genWithKeyMap("vid_click_cf_feature_20250212", vid, ImmutableMap.of("vid_a", headVid, "vid_b", vid)));
+            protos.add(genWithKeyMap("alg_recsys_feature_cf_i2i_v2", vid, ImmutableMap.of("vid_a", headVid, "vid_b", vid)));
+            if (null != videoBaseInfoMap) {
+                Map<String, Map<String, String>> videoInfo = videoBaseInfoMap.getOrDefault(vid, new HashMap<>());
+                Map<String, String> baseInfo = videoInfo.getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
+                String merge_cate1 = baseInfo.getOrDefault("merge_first_level_cate", "unknown");
+                protos.add(genWithKeyMap("alg_merge_cate1_recommend_exp_feature_20250212", vid, ImmutableMap.of("merge_cate1", merge_cate1)));
+                // 特殊情况
+                //protos.add(genWithKeyMap("mid_merge_cate1_feature_20250212", vid, ImmutableMap.of("mid", mid, "merge_cate1", merge_cate1)));
+
+                String merge_cate2 = baseInfo.getOrDefault("merge_second_level_cate", "unknown");
+                protos.add(genWithKeyMap("alg_merge_cate2_recommend_exp_feature_20250212", vid, ImmutableMap.of("merge_cate2", merge_cate2)));
+                // 特殊情况
+                //protos.add(genWithKeyMap("mid_merge_cate2_feature_20250212", vid, ImmutableMap.of("mid", mid, "merge_cate2", merge_cate2)));
+
+                String channel = baseInfo.getOrDefault("channel", "unknown");
+                protos.add(genWithKeyMap("alg_channel_recommend_exp_feature_20250212", vid, ImmutableMap.of("channel", channel)));
+
+                String festive = baseInfo.getOrDefault("festive_label2", "unknown");
+                protos.add(genWithKeyMap("alg_festive_recommend_exp_feature_20250212", vid, ImmutableMap.of("festive", festive)));
+
+                String videoUnionid = baseInfo.getOrDefault("title_time_w_h_unionid", "unknown");
+                protos.add(genWithKeyMap("alg_video_unionid_recommend_exp_feature_20250212", 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));
+
+        // ********************* new mid ******************
+        protos.add(genWithMid("mid_global_feature_20250212", mid));
+        protos.add(genWithMid("mid_u2u_friend_index_feature_20250212", mid));
+        protos.add(genWithMid("alg_recsys_feature_user_share_return_stat", mid));
+
+        return getFeatureByProto(protos);
+    }
+
     public Feature getFeatureByNewLabel(String appType, String hotSceneType, String province, String brand, String mid, String headVideoId, List<String> vidList, Map<String, Map<String, Map<String, String>>> videoBaseInfoMap) {
 
         List<FeatureKeyProto> protos = new ArrayList<>();

+ 13 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/bo/UserSRBO.java

@@ -0,0 +1,13 @@
+package com.tzld.piaoquan.recommend.server.service.rank.bo;
+
+import lombok.Data;
+
+@Data
+public class UserSRBO {
+    // JSON_OBJECT("id",vid,"cnt",share_cnt,"ts",ts)
+    // JSON_OBJECT("id",vid,"uv",return_n_uv_noself,"ts",ts)
+    private long id;   // return vid
+    private long cnt;  // share cnt
+    private long uv;   // return uv
+    private long ts;   // view ts
+}

+ 73 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/bo/UserShareReturnProfile.java

@@ -0,0 +1,73 @@
+package com.tzld.piaoquan.recommend.server.service.rank.bo;
+
+import com.alibaba.fastjson.JSON;
+import lombok.Data;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class UserShareReturnProfile {
+    private long s_pv;                  // share_pv(分享pv)
+    private long s_cnt;                 // share_cnt(分享次数)
+    private long r_pv;                  // return_pv(回流pv)
+    private long r_uv;                  // return_uv(回流uv)
+    private long m_s_cnt;               // max_share_cnt(最大分享次数)
+    private long m_r_uv;                // max_return_uv(最大回流uv)
+    private List<UserSRBO> m_s_s;    // max_share_seq(最大分享序列)
+    private List<UserSRBO> m_r_s;   // max_return_seq(最大回流序列)
+    private List<UserSRBO> l_s_s;    // last_share_seq(最近分享序列)
+    private List<UserSRBO> l_r_s;   // last_return_seq(最近回流序列)
+    private Map<String, VideoAttrSRBO> c1_s;   // cate1_seq(merge_first_level_cate序列-回流率)
+    private Map<String, VideoAttrSRBO> c2_s;   // cate2_seq(merge_second_level_cate序列-回流率)
+    private Map<String, VideoAttrSRBO> l1_s;   // label1_seq(festive_label1序列-回流率)
+    private Map<String, VideoAttrSRBO> l2_s;   // label2_seq(festive_label2序列-回流率)
+
+    public void setM_s_s(String data) {
+        this.m_s_s = JSON.parseArray(data, UserSRBO.class);
+    }
+
+    public void setM_r_s(String data) {
+        this.m_r_s = JSON.parseArray(data, UserSRBO.class);
+    }
+
+    public void setL_s_s(String data) {
+        this.l_s_s = JSON.parseArray(data, UserSRBO.class);
+    }
+
+    public void setL_r_s(String data) {
+        this.l_r_s = JSON.parseArray(data, UserSRBO.class);
+    }
+
+    public void setC1_s(String data) {
+        this.c1_s = parseVideoAttrSR(data);
+    }
+
+    public void setC2_s(String data) {
+        this.c2_s = parseVideoAttrSR(data);
+    }
+
+    public void setL1_s(String data) {
+        this.l1_s = parseVideoAttrSR(data);
+    }
+
+    public void setL2_s(String data) {
+        this.l2_s = parseVideoAttrSR(data);
+    }
+
+    private Map<String, VideoAttrSRBO> parseVideoAttrSR(String data) {
+        Map<String, VideoAttrSRBO> map = new HashMap<>();
+        if (null != data && !data.isEmpty()) {
+            List<VideoAttrSRBO> list = JSON.parseArray(data, VideoAttrSRBO.class);
+            if (null != list) {
+                for (VideoAttrSRBO v : list) {
+                    if (null != v) {
+                        map.put(v.getNa(), v);
+                    }
+                }
+            }
+        }
+        return map;
+    }
+}

+ 16 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/bo/VideoAttrSRBO.java

@@ -0,0 +1,16 @@
+package com.tzld.piaoquan.recommend.server.service.rank.bo;
+
+import lombok.Data;
+
+@Data
+public class VideoAttrSRBO {
+    // JSON_OBJECT("na",cate1,"sp",share_pv,"rp",return_n_pv_noself,"ru",return_n_uv_noself,"mu",max_return_uv)
+    // JSON_OBJECT("na",cate2,"sp",share_pv,"rp",return_n_pv_noself,"ru",return_n_uv_noself,"mu",max_return_uv)
+    // JSON_OBJECT("na",label1,"sp",share_pv,"rp",return_n_pv_noself,"ru",return_n_uv_noself,"mu",max_return_uv)
+    // JSON_OBJECT("na",label2,"sp",share_pv,"rp",return_n_pv_noself,"ru",return_n_uv_noself,"mu",max_return_uv)
+    private String na;  // attr name
+    private long sp;    // share_pv
+    private long rp;    // return_n_pv_noself
+    private long ru;    // return_n_uv_noself
+    private long mu;    // max_return_uv
+}

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

@@ -1,18 +1,21 @@
 package com.tzld.piaoquan.recommend.server.service.rank.strategy;
 
+import com.alibaba.fastjson.JSON;
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.piaoquan.recommend.server.common.ThreadPoolFactory;
 import com.tzld.piaoquan.recommend.server.common.base.RankItem;
 import com.tzld.piaoquan.recommend.server.model.Video;
 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.bo.UserSRBO;
+import com.tzld.piaoquan.recommend.server.service.rank.bo.UserShareReturnProfile;
 import com.tzld.piaoquan.recommend.server.service.rank.extractor.ExtractorUtils;
+import com.tzld.piaoquan.recommend.server.service.rank.tansform.NORFeature;
 import com.tzld.piaoquan.recommend.server.service.recall.strategy.*;
 import com.tzld.piaoquan.recommend.server.service.score.ScorerUtils;
 import com.tzld.piaoquan.recommend.server.util.CommonCollectionUtils;
 import com.tzld.piaoquan.recommend.server.util.FeatureBucketUtils;
-import com.tzld.piaoquan.recommend.server.util.FeatureUtils;
-import com.tzld.piaoquan.recommend.server.util.SimilarityUtils;
+import com.tzld.piaoquan.recommend.server.util.JSONUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.math3.util.Pair;
@@ -33,16 +36,6 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
     @Autowired
     private FeatureService featureService;
 
-    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("cate1_list", "cate2", "cate2_list",
-            "keywords", "style", "theme", "title", "topic", "user_value");
-    private static final List<String> videoCateAttr = Arrays.asList(FeatureUtils.cate1Attr, FeatureUtils.cate2Attr, FeatureUtils.festive1Attr);
-    private static final double smoothPlus = 5.0;
-
     @Override
     public List<Video> mergeAndRankRovRecall(RankParam param) {
         Map<String, Double> mergeWeight = this.mergeWeight != null ? this.mergeWeight : new HashMap<>(0);
@@ -50,6 +43,7 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
         //-------------------合-------------------
         //-------------------逻-------------------
         //-------------------辑-------------------
+
         long currentMs = System.currentTimeMillis();
         List<Video> oldRovs = new ArrayList<>();
         oldRovs.addAll(extractAndSort(param, RegionHRecallStrategy.PUSH_FORM));
@@ -75,7 +69,7 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
         //-------------------新地域召回------------------
         List<Video> v1 = extractAndSort(param, RegionRealtimeRecallStrategyV1.PUSH_FORM);
         v1 = v1.stream().filter(r -> !setVideo.contains(r.getVideoId())).collect(Collectors.toList());
-        v1 = v1.subList(0, Math.min(mergeWeight.getOrDefault("v1", 10.0).intValue(), v1.size()));
+        v1 = v1.subList(0, Math.min(mergeWeight.getOrDefault("v1", 5.0).intValue(), v1.size()));
         rovRecallRank.addAll(v1);
         setVideo.addAll(v1.stream().map(Video::getVideoId).collect(Collectors.toSet()));
         //-------------------scene cf rovn------------------
@@ -100,15 +94,19 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
         List<String> vids = CommonCollectionUtils.toListDistinct(rovRecallRank, v -> String.valueOf(v.getVideoId()));
 
         // k1:视频、k2:表、k3:特征、v:特征值
-        String provinceCn = param.getProvince().replaceAll("省$", "");
         String headVid = String.valueOf(param.getHeadVid());
-        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);
+        FeatureService.Feature feature = featureService.getFeatureV3(param, 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<>());
 
+        // 用户信息预处理
+        Map<String, Map<String, String[]>> newC7Map = NORFeature.parseUCFScore(featureOriginUser.getOrDefault("alg_mid_feature_sharecf", new HashMap<>()));
+        Map<String, Map<String, String[]>> newC8Map = NORFeature.parseUCFScore(featureOriginUser.getOrDefault("alg_mid_feature_returncf", new HashMap<>()));
+        UserShareReturnProfile userProfile = parseUserProfile(featureOriginUser);
+        Map<String, Map<String, String>> userBehaviorVideoMap = getUserBehaviorVideoMap(userProfile);
+
         // 2 特征处理
         Map<String, Double> userFeatureMapDouble = new HashMap<>();
         String mid = param.getMid();
@@ -122,9 +120,6 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
         Map<String, String> c8 = featureOriginUser.getOrDefault("alg_mid_feature_sharecf", new HashMap<>());
         Map<String, String> c9 = featureOriginUser.getOrDefault("alg_mid_feature_returncf", new HashMap<>());
 
-        // time feature
-        addTimeFeature(currentMs, userFeatureMapDouble);
-
         if (!c1.isEmpty()) {
             userFeatureMapDouble.put("playcnt_6h", Double.parseDouble(c1.getOrDefault("playcnt_6h", "0")));
             userFeatureMapDouble.put("playcnt_1d", Double.parseDouble(c1.getOrDefault("playcnt_1d", "0")));
@@ -221,29 +216,23 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
                     double share = tuple4.second.isEmpty() ? 0 : Double.parseDouble(tuple4.second.getOrDefault("share_pv_" + prefix2, "0.0"));
                     double returns = tuple4.third.isEmpty() ? 0 : Double.parseDouble(tuple4.third.getOrDefault("return_uv_" + prefix2, "0.0"));
 
-                    double f0 = ExtractorUtils.calLog(exp);
                     double f1 = ExtractorUtils.calDiv(share, exp);
                     double f2 = ExtractorUtils.calLog(share);
                     double f3 = ExtractorUtils.calDiv(returns, exp);
                     double f4 = ExtractorUtils.calLog(returns);
                     double f5 = f3 * f4;
-                    double f6 = ExtractorUtils.calDiv(returns, share);
 
-                    String key0 = tuple4.name + "_" + prefix2 + "_" + "EXP";
                     String key1 = tuple4.name + "_" + prefix2 + "_" + "STR";
                     String key2 = tuple4.name + "_" + prefix2 + "_" + "log(share)";
                     String key3 = tuple4.name + "_" + prefix2 + "_" + "ROV";
                     String key4 = tuple4.name + "_" + prefix2 + "_" + "log(return)";
                     String key5 = tuple4.name + "_" + prefix2 + "_" + "ROV*log(return)";
-                    String key6 = tuple4.name + "_" + prefix2 + "_" + "ROS";
 
-                    featureMap.put(key0, f0);
                     featureMap.put(key1, f1);
                     featureMap.put(key2, f2);
                     featureMap.put(key3, f3);
                     featureMap.put(key4, f4);
                     featureMap.put(key5, f5);
-                    featureMap.put(key6, f6);
                 }
             }
 
@@ -301,20 +290,17 @@ 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);
-            addVideoAttrFeature(videoInfo, featureMap);
-            addVideoTimeFeature(currentMs, videoInfo, featureMap);
-
             item.featureMapDouble = featureMap;
         }
 
+        // get nor feature
+        Map<String, String> norUserFeatureMap = getNorUserFeature(currentMs, headVideoInfo, userProfile, featureOriginUser);
+        batchGetNorVideoFeature(currentMs, userProfile, headVideoInfo, videoBaseInfoMap,
+                newC7Map, newC8Map, featureOriginUser, userBehaviorVideoMap, featureOriginVideo, rankItems);
+
         // 3 连续值特征分桶
         readBucketFile();
         Map<String, String> userFeatureMap = new HashMap<>(userFeatureMapDouble.size());
-        Map<String, String> norUserFeatureMap = FeatureBucketUtils.noBucketFeature(userFeatureMapDouble);
         for (Map.Entry<String, Double> entry : userFeatureMapDouble.entrySet()) {
             String name = entry.getKey();
             Double score = entry.getValue();
@@ -342,19 +328,12 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
                 }
             }
             item.featureMap = featureMap;
-            item.norFeatureMap = FeatureBucketUtils.noBucketFeature(featureMapDouble);
         }
         // 4 排序模型计算
-        double fmRovLogBase = mergeWeight.getOrDefault("fmRovLogBase", 2.8);
-        double xgbNorScaleType = mergeWeight.getOrDefault("xgbNorScaleType", 0.0);
-        double xgbNorBias = mergeWeight.getOrDefault("xgbNorBias", -1.6945);
-        double xgbNorWeight = mergeWeight.getOrDefault("xgbNorWeight", 1.8968);
-        double xgbNorPowerWeight = mergeWeight.getOrDefault("xgbNorPowerWeight", 1.2216);
-        double xgbNorPowerExp = mergeWeight.getOrDefault("xgbNorPowerExp", 1.3217);
-        double vorLogWeight = mergeWeight.getOrDefault("vorLogWeight", 10.0);
-        double vorLogBase = mergeWeight.getOrDefault("vorLogBase", 2.6);
+        double xgbNorPowerWeight = mergeWeight.getOrDefault("xgbNorPowerWeight", 1.22);
+        double xgbNorPowerExp = mergeWeight.getOrDefault("xgbNorPowerExp", 1.24);
         Map<String, String> sceneFeatureMap = new HashMap<>(0);
-        List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_fm_xgb_20250218.conf").scoring(sceneFeatureMap, userFeatureMap, norUserFeatureMap, rankItems);
+        List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_fm_xgb_20250221.conf").scoring(sceneFeatureMap, userFeatureMap, norUserFeatureMap, rankItems);
         // 5 排序公式特征
         Map<String, Map<String, String>> vid2MapFeature = this.getVideoRedisFeature(vids, "redis:vid_hasreturn_vor:");
         List<Video> result = new ArrayList<>();
@@ -364,15 +343,13 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
             item.getScoresMap().put("fmRovOrigin", fmRovOrigin);
             double fmRov = restoreScore(fmRovOrigin);
             item.getScoresMap().put("fmRov", fmRov);
-            double newFmRov = logRov(fmRov, fmRovLogBase);
             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 = norCalibration(xgbNorScaleType, xgbNorBias, xgbNorWeight, xgbNorPowerWeight, xgbNorPowerExp, norXGBScore);
+            double newNorXGBScore = norPowerCalibration(xgbNorPowerWeight, xgbNorPowerExp, norXGBScore);
             double vor = Double.parseDouble(vid2MapFeature.getOrDefault(item.getVideoId() + "", new HashMap<>()).getOrDefault("vor", "0"));
-            double newVor = logVor(vorLogWeight, vor, vorLogBase);
             item.getScoresMap().put("vor", vor);
-            score = newFmRov * (0.1 + newNorXGBScore) * (0.1 + newVor);
+            score = fmRov * (0.1 + newNorXGBScore) * (0.1 + vor);
             Video video = item.getVideo();
             video.setScore(score);
             video.setSortScore(score);
@@ -396,172 +373,126 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
         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("b29", shortPeriod, getVideoOneTypeInfo(vid, "alg_videoid_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 view = getVideoOneInfo("view_" + period, infoMap);
-                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 = ExtractorUtils.smoothDiv(return_, share, smoothPlus);
-                double rov = ExtractorUtils.smoothDiv(return_, view, smoothPlus);
-                double r_cnt = ExtractorUtils.smoothDiv(return_, view_hasreturn, smoothPlus);
-                double r_rate = ExtractorUtils.smoothDiv(view_hasreturn, view, smoothPlus);
-                double r_cnt4s = ExtractorUtils.smoothDiv(return_, share_hasreturn, smoothPlus);
-                double str = ExtractorUtils.smoothDiv(share, view, smoothPlus);
-                double s2r_rate = ExtractorUtils.smoothDiv(share_hasreturn, share, smoothPlus);
-
-                featureMap.put(infoType + "_" + period + "_" + "view", ExtractorUtils.calLog(view));
-                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);
-                featureMap.put(infoType + "_" + period + "_" + "s2r_rate", s2r_rate);
-            }
-        }
-    }
-
-    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 UserShareReturnProfile parseUserProfile(Map<String, Map<String, String>> userOriginInfo) {
+        if (null != userOriginInfo) {
+            Map<String, String> c9 = userOriginInfo.get("alg_recsys_feature_user_share_return_stat");
+            if (null != c9 && !c9.isEmpty()) {
+                String c9Str = JSONUtils.toJson(c9);
+                if (!c9Str.isEmpty()) {
+                    try {
+                        return JSON.parseObject(c9Str, UserShareReturnProfile.class);
+                    } catch (Exception e) {
+                        log.error("parseObject user profile error! value=[{}]", c9Str, e);
+                    }
                 }
             }
         }
+        return null;
     }
 
-    private void addVideoSimFeature(Map<String, String> headInfo, Map<String, String> rankInfo, Map<String, Double> featureMap) {
-        if (!headInfo.isEmpty() && !rankInfo.isEmpty()) {
-            List<Future<Pair<String, Double>>> futures = new ArrayList<>();
-            for (String attr : videoSimAttrs) {
-                String headAttr = headInfo.getOrDefault(attr, "");
-                String rankAttr = rankInfo.getOrDefault(attr, "");
-                if (!"".equals(headAttr) && !"".equals(rankAttr)) {
-                    String key = "video_sim_" + attr;
-                    Future<Pair<String, Double>> future = ThreadPoolFactory.defaultPool().submit(() -> {
-                        double simScore = SimilarityUtils.word2VecSimilarity(headAttr, rankAttr);
-                        return Pair.create(key, simScore);
-                    });
-                    futures.add(future);
-                }
-            }
-            try {
-                for (Future<Pair<String, Double>> future : futures) {
-                    Pair<String, Double> pair = future.get(1000, TimeUnit.MILLISECONDS);
-                    featureMap.put(pair.getFirst(), pair.getSecond());
+    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() + "");
+                        }
+                    }
                 }
-            } catch (Exception e) {
-                log.error("video attr similarity error", e);
             }
         }
-    }
 
-    private void addVideoAttrFeature(Map<String, String> rankInfo, Map<String, Double> featureMap) {
-        if (!rankInfo.isEmpty()) {
-            for (String attr : videoCateAttr) {
-                String attrVal = rankInfo.getOrDefault(attr, "");
-                int attrId = FeatureUtils.getAttrId(attr, attrVal);
-                if (attrId > 0) {
-                    String key = String.format("%s@%s@%d", "r", attr, attrId);
-                    featureMap.put(key, 1.0);
+        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 void addVideoTimeFeature(long currentMs, Map<String, String> rankInfo, Map<String, Double> featureMap) {
-        double createTime = 1D;
-        try {
-            if (!rankInfo.isEmpty() && rankInfo.containsKey("gmt_create_timestamp")) {
-                String createMsStr = rankInfo.get("gmt_create_timestamp");
-                long createMs = Long.parseLong(createMsStr);
-                createTime = FeatureUtils.getCreateTime(currentMs, createMs);
-            }
-        } catch (Exception e) {
-            log.error("get video crate time error", e);
-        }
-        featureMap.put("createTime", createTime);
-    }
+    private Map<String, String> getNorUserFeature(long currentMs, Map<String, String> headInfo, UserShareReturnProfile userProfile, Map<String, Map<String, String>> userOriginInfo) {
+        Map<String, Double> featMap = new HashMap<>();
+        // context feature
+        NORFeature.getContextFeature(currentMs, featMap);
+
+        // head video feature
+        NORFeature.getVideoBaseFeature("h", currentMs, headInfo, featMap);
 
-    private void addTimeFeature(long currentMs, Map<String, Double> featureMap) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTimeInMillis(currentMs);
+        // user feature
+        NORFeature.getUserFeature(userOriginInfo, featMap);
+        NORFeature.getUserProfileFeature(userProfile, featMap);
 
-        int week = calendar.get(Calendar.DAY_OF_WEEK);
-        int hour = calendar.get(Calendar.HOUR_OF_DAY) + 1;
-        featureMap.put("week", week * 1.0);
-        featureMap.put("hour", hour * 1.0);
+        return FeatureBucketUtils.noBucketFeature(featMap);
     }
 
-    private double norCalibration(double scaleType, double polyBias, double polyWeight, double powerWeight, double powerExp, double score) {
-        if (scaleType < 1) {
-            return norPolyCalibration(polyBias, polyWeight, score);
-        } else {
-            return norPowerCalibration(powerWeight, powerExp, score);
-        }
+    private Map<String, String> getNorVideoFeature(long currentMs, String vid,
+                                                   UserShareReturnProfile userProfile,
+                                                   Map<String, String> headInfo, Map<String, String> rankInfo,
+                                                   Map<String, Map<String, String[]>> c7Map,
+                                                   Map<String, Map<String, String[]>> c8Map,
+                                                   Map<String, Map<String, String>> userOriginInfo,
+                                                   Map<String, Map<String, String>> historyVideoMap,
+                                                   Map<String, Map<String, Map<String, String>>> videoOriginInfo) {
+        Map<String, Double> featMap = new HashMap<>();
+        // user & video feature
+        NORFeature.getUserTagsCrossVideoFeature("c5", rankInfo, userOriginInfo.get("alg_mid_feature_return_tags"), featMap);
+        NORFeature.getUserTagsCrossVideoFeature("c6", rankInfo, userOriginInfo.get("alg_mid_feature_share_tags"), featMap);
+        NORFeature.getUserCFFeature("c7", vid, c7Map, featMap);
+        NORFeature.getUserCFFeature("c8", vid, c8Map, featMap);
+
+        // rank video feature
+        NORFeature.getVideoBaseFeature("r", currentMs, rankInfo, featMap);
+        NORFeature.getVideoFeature(vid, videoOriginInfo, featMap);
+
+        // head&rank cross feature
+        NORFeature.getHeadRankVideoCrossFeature(headInfo, rankInfo, featMap);
+
+        // user profile & rank cross
+        NORFeature.getProfileVideoCrossFeature(currentMs, userProfile, rankInfo, historyVideoMap, featMap);
+
+        return FeatureBucketUtils.noBucketFeature(featMap);
     }
 
-    private double norPolyCalibration(double bias, double weight, double score) {
-        double newScore = bias + weight * score;
-        if (newScore < score) {
-            newScore = score;
+    private void batchGetNorVideoFeature(long currentMs,
+                                         UserShareReturnProfile userProfile,
+                                         Map<String, String> headInfo,
+                                         Map<String, Map<String, Map<String, String>>> videoBaseInfoMap,
+                                         Map<String, Map<String, String[]>> c7Map,
+                                         Map<String, Map<String, String[]>> c8Map,
+                                         Map<String, Map<String, String>> userOriginInfo,
+                                         Map<String, Map<String, String>> historyVideoMap,
+                                         Map<String, Map<String, Map<String, String>>> videoOriginInfo,
+                                         List<RankItem> rankItems) {
+        if (null != rankItems && !rankItems.isEmpty()) {
+            List<Future<Integer>> futures = new ArrayList<>();
+            for (RankItem item : rankItems) {
+                String vid = item.getVideoId() + "";
+                Map<String, String> rankInfo = videoBaseInfoMap.getOrDefault(vid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
+                Future<Integer> future = ThreadPoolFactory.defaultPool().submit(() -> {
+                    item.norFeatureMap = getNorVideoFeature(currentMs, vid, userProfile, headInfo, rankInfo, c7Map, c8Map, userOriginInfo, historyVideoMap, videoOriginInfo);
+                    return 1;
+                });
+                futures.add(future);
+            }
+
+            try {
+                for (Future<Integer> future : futures) {
+                    future.get(1000, TimeUnit.MILLISECONDS);
+                }
+            } catch (Exception e) {
+                log.error("get nor feature error", e);
+            }
         }
-        return newScore;
     }
 
     private double norPowerCalibration(double weight, double exp, double score) {
@@ -573,20 +504,4 @@ public class RankStrategy4RegionMergeModelV564 extends RankStrategy4RegionMergeM
         }
         return newScore;
     }
-
-    private double logRov(double x, double base) {
-        if (base > 1) {
-            return Math.log(1 + x) / Math.log(base);
-        } else {
-            return x;
-        }
-    }
-
-    private double logVor(double weight, double x, double base) {
-        if (base > 1) {
-            return weight * Math.log(1 + x / 10) / Math.log(base);
-        } else {
-            return x;
-        }
-    }
 }

+ 421 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/tansform/NORFeature.java

@@ -0,0 +1,421 @@
+package com.tzld.piaoquan.recommend.server.service.rank.tansform;
+
+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.VideoAttrSRBO;
+import com.tzld.piaoquan.recommend.server.service.rank.extractor.ExtractorUtils;
+import com.tzld.piaoquan.recommend.server.util.FeatureUtils;
+import com.tzld.piaoquan.recommend.server.util.SimilarityUtils;
+
+import java.util.*;
+
+public class NORFeature {
+    private static final int seqMaxN = 2;
+    private static final int seqLastN = 2;
+    private static final double smoothPlus = 5.0;
+    private static final List<String> c1Periods = Arrays.asList("72h", "168h");
+    private static final List<String> c4Periods = Arrays.asList("72h", "168h");
+    private static final List<String> b1Periods = Arrays.asList("1h", "3h", "24h", "72h", "168h");
+    private static final List<String> b2Periods = Arrays.asList("1h", "3h", "24h");
+    private static final List<String> b3Periods = Arrays.asList("24h", "168h");
+    private static final List<String> b4Periods = Arrays.asList("1h", "12h");
+    private static final List<String> b5Periods = Arrays.asList("72h", "168h");
+    private static final List<String> b6Periods = Arrays.asList("1h", "24h");
+    private static final List<String> b7Periods = Arrays.asList("24h", "168h");
+    private static final List<String> b8Periods = Arrays.asList("24h");
+    private static final List<String> b9Periods = Arrays.asList("24h");
+    private static final List<String> b10Periods = Arrays.asList("1h", "12h");
+    private static final List<String> b11Periods = Arrays.asList("12h", "168h");
+    private static final List<String> b13Periods = Arrays.asList("24h", "168h");
+    private static final List<String> dayPeriods = Arrays.asList("7d", "14d", "30d", "60d");
+    private static final List<String> videoCateAttrs = Arrays.asList(FeatureUtils.cate1Attr, FeatureUtils.cate2Attr, FeatureUtils.festive1Attr);
+    private static final List<String> videoSimAttrs = Arrays.asList("title", "cate2", "cate2_list", "keywords");
+    private static final List<String> hVideoSimAttrs = Arrays.asList("title");
+    private static final List<String> cfList = Arrays.asList("share", "return");
+
+    public static void getContextFeature(long currentMs, Map<String, Double> featureMap) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeInMillis(currentMs);
+
+        int week = calendar.get(Calendar.DAY_OF_WEEK);
+        int hour = calendar.get(Calendar.HOUR_OF_DAY) + 1;
+        featureMap.put("week", week * 1.0);
+        featureMap.put("hour", hour * 1.0);
+    }
+
+    public static void getUserFeature(Map<String, Map<String, String>> userOriginInfo, Map<String, Double> featMap) {
+        oneTypeStatFeature("c1", "return_1_uv", c1Periods, userOriginInfo.get("mid_global_feature_20250212"), featMap);
+        Map<String, String> c4Map = userOriginInfo.get("mid_u2u_friend_index_feature_20250212");
+        for (String calType : Arrays.asList("avg_", "max_", "min_")) {
+            getRateStatFeature("c4", calType, c4Periods, c4Map, featMap);
+        }
+    }
+
+    public static void getUserProfileFeature(UserShareReturnProfile profile, Map<String, Double> featMap) {
+        if (null != profile) {
+            long s_pv = profile.getS_pv();              // share_pv(分享pv)
+            long s_cnt = profile.getS_cnt();            // share_cnt(分享次数)
+            long r_pv = profile.getR_pv();              // return_pv(回流pv)
+            long r_uv = profile.getR_uv();              // return_uv(回流uv)
+            long m_s_cnt = profile.getM_s_cnt();        // max_share_cnt(最大分享次数)
+            long m_r_uv = profile.getM_r_uv();          // max_return_uv(最大回流uv)
+            if (s_pv > 0) {
+                double s_pv_s = FeatureUtils.log1(s_pv);
+                double s_cnt_s = FeatureUtils.log1(s_cnt);
+                double r_pv_s = FeatureUtils.log1(r_pv);
+                double r_uv_s = FeatureUtils.log1(r_uv);
+                double m_s_cnt_s = FeatureUtils.log1(m_s_cnt);
+                double m_r_uv_s = FeatureUtils.log1(m_r_uv);
+                double ros_one = FeatureUtils.wilsonScore(r_pv, s_pv);
+                double ros = FeatureUtils.plusSmooth(r_uv, s_pv, smoothPlus);
+                double ros_minus = FeatureUtils.plusSmooth(r_uv, r_pv, smoothPlus);
+                featMap.put("c9_s_pv", s_pv_s);
+                featMap.put("c9_s_cnt", s_cnt_s);
+                featMap.put("c9_r_pv", r_pv_s);
+                featMap.put("c9_r_uv", r_uv_s);
+                featMap.put("c9_m_s_cnt", m_s_cnt_s);
+                featMap.put("c9_m_r_uv", m_r_uv_s);
+                featMap.put("c9_ros_one", ros_one);
+                featMap.put("c9_ros", ros);
+                featMap.put("c9_ros_minus", ros_minus);
+            }
+        }
+    }
+
+    public static void getUserTagsCrossVideoFeature(String prefix, Map<String, String> videoInfo, Map<String, String> infoMap, Map<String, Double> featMap) {
+        if (null == videoInfo || videoInfo.isEmpty() || null == infoMap || infoMap.isEmpty()) {
+            return;
+        }
+        String title = videoInfo.getOrDefault("title", "");
+        if (title.isEmpty()) {
+            return;
+        }
+        for (String period : Arrays.asList("tags_1d", "tags_3d", "tags_7d")) {
+            String tags = infoMap.getOrDefault(period, "");
+            if (!tags.isEmpty()) {
+                Double[] doubles = ExtractorUtils.funcC34567ForTagsNew(tags, title);
+                featMap.put(prefix + "_" + period + "_matchnum", doubles[0]);
+                featMap.put(prefix + "_" + period + "_maxscore", doubles[1]);
+                featMap.put(prefix + "_" + period + "_avgscore", doubles[2]);
+            }
+        }
+    }
+
+    public static void getUserCFFeature(String prefix, String vid, Map<String, Map<String, String[]>> infoMap, Map<String, Double> featMap) {
+        if (vid.isEmpty() || null == infoMap || infoMap.isEmpty()) {
+            return;
+        }
+        for (String cfType : cfList) {
+            if (infoMap.containsKey(cfType)) {
+                Map<String, String[]> cfScoresMap = infoMap.get(cfType);
+                if (null != cfScoresMap && cfScoresMap.containsKey(vid)) {
+                    String[] scores = cfScoresMap.get(vid);
+                    Double score1 = Double.parseDouble(scores[0]);
+                    Double score2 = Double.parseDouble(scores[1]);
+                    Double score3 = Double.parseDouble(scores[2]) <= 0 ? 0D : 1.0 / Double.parseDouble(scores[2]);
+                    featMap.put(prefix + "_" + cfType + "_score", score1);
+                    featMap.put(prefix + "_" + cfType + "_num", score2);
+                    featMap.put(prefix + "_" + cfType + "_rank", score3);
+                }
+            }
+        }
+    }
+
+    public static void getVideoFeature(String vid, Map<String, Map<String, Map<String, String>>> videoOriginInfo, Map<String, Double> featMap) {
+        oneTypeStatFeature("b1", "return_1_uv", b1Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_vid_global_feature_20250212"), featMap);
+        oneTypeStatFeature("b2", "return_n_uv", b2Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_vid_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b3", "return_n_uv", b3Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_vid_recommend_flowpool_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b4", "return_n_uv", b4Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_vid_apptype_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b5", "return_n_uv", b5Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_vid_province_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b6", "return_n_uv", b6Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_vid_brand_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b7", "return_n_uv", b7Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_vid_hotsencetype_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b8", "return_n_uv", b8Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_merge_cate1_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b9", "return_n_uv", b9Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_merge_cate2_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b10", "return_n_uv", b10Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_channel_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b11", "return_n_uv", b11Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_festive_recommend_exp_feature_20250212"), featMap);
+        //getRateStatFeature("b12", "", dayPeriods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_vid_long_period_recommend_exp_feature_20250212"), featMap);
+        oneTypeStatFeature("b13", "return_n_uv", b13Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_video_unionid_recommend_exp_feature_20250212"), featMap);
+
+        // head video cf
+        headVideoCFD1Feature("d1", videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("scene_type_vid_cf_feature_20250212"), featMap);
+        headVideoCFD2Feature("d2", videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("vid_click_cf_feature_20250212"), featMap);
+        headVideoCFD3Feature("d3", videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("alg_recsys_feature_cf_i2i_v2"), featMap);
+
+        // 特殊mid * cate
+        oneTypeStatFeature("c2", "return_n_uv", c1Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("mid_merge_cate1_feature_20250212"), featMap);
+        oneTypeStatFeature("c3", "return_n_uv", c1Periods, videoOriginInfo.getOrDefault(vid, new HashMap<>()).get("mid_merge_cate2_feature_20250212"), featMap);
+    }
+
+    public static void getVideoBaseFeature(String prefix, long currentMs, Map<String, String> videoInfo, Map<String, Double> featMap) {
+        if (null == videoInfo || videoInfo.isEmpty()) {
+            return;
+        }
+        featMap.put(prefix + "@total_time", Double.parseDouble(videoInfo.getOrDefault("total_time", "0")));
+        featMap.put(prefix + "@bit_rate", Double.parseDouble(videoInfo.getOrDefault("bit_rate", "0")));
+
+        // cate
+        // getVideoCateFeature(prefix, videoInfo, featMap);
+        if (videoInfo.containsKey("title")) {
+            int id = FeatureUtils.judgeVideoTimeType(videoInfo.get("title"));
+            if (id > 0) {
+                String key = String.format("%s@%s@%d", prefix, "tt", id);
+                featMap.put(key, 1.0);
+            }
+        }
+
+        // time
+        try {
+            if (videoInfo.containsKey("gmt_create_timestamp")) {
+                String createMsStr = videoInfo.get("gmt_create_timestamp");
+                long createMs = Long.parseLong(createMsStr);
+                double createTime = FeatureUtils.getTimeDiff(currentMs, createMs);
+                featMap.put(prefix + "@ts", 1 - createTime);
+            }
+        } catch (Exception ignored) {
+        }
+    }
+
+    public static void getHeadRankVideoCrossFeature(Map<String, String> headInfo, Map<String, String> rankInfo, Map<String, Double> featMap) {
+        getTwoVideoCrossFeature("hr_sim", NORFeature.videoSimAttrs, headInfo, rankInfo, featMap);
+    }
+
+    public static void getProfileVideoCrossFeature(long currentMs, UserShareReturnProfile profile, Map<String, String> rankVideo, Map<String, Map<String, String>> hVideoMap, Map<String, Double> featMap) {
+        if (null == profile) {
+            return;
+        }
+        getRSCrossFeature("c9_mss", currentMs, seqMaxN, profile.getM_s_s(), rankVideo, hVideoMap, featMap);
+        getRSCrossFeature("c9_mrs", currentMs, seqMaxN, profile.getM_r_s(), rankVideo, hVideoMap, featMap);
+        getRSCrossFeature("c9_lss", currentMs, seqLastN, profile.getL_s_s(), rankVideo, hVideoMap, featMap);
+        getRSCrossFeature("c9_lrs", currentMs, seqLastN, profile.getL_r_s(), rankVideo, hVideoMap, featMap);
+
+        if (null == rankVideo || rankVideo.isEmpty()) {
+            return;
+        }
+        getVideoAttrSRCrossFeature("c9_c1s", rankVideo.getOrDefault("merge_first_level_cate", ""), profile.getC1_s(), featMap);
+        getVideoAttrSRCrossFeature("c9_c2s", rankVideo.getOrDefault("merge_second_level_cate", ""), profile.getC2_s(), featMap);
+        getVideoAttrSRCrossFeature("c9_l1s", rankVideo.getOrDefault("festive_label1", ""), profile.getL1_s(), featMap);
+        getVideoAttrSRCrossFeature("c9_l2s", rankVideo.getOrDefault("festive_label2", ""), profile.getL2_s(), featMap);
+    }
+
+    private static void getRSCrossFeature(String prefix, long currentMs, int maxN, List<UserSRBO> list, Map<String, String> rankVideo, Map<String, Map<String, String>> hVideoMap, Map<String, Double> featMap) {
+        if (null != list && !list.isEmpty()) {
+            for (int i = 0; i < list.size() && i < maxN; i++) {
+                UserSRBO u = list.get(i);
+                if (null != u) {
+                    long id = u.getId();
+                    long cnt = u.getCnt();
+                    long uv = u.getUv();
+                    long ts = u.getTs();
+                    if (id > 0) {
+                        String vid = id + "";
+                        String baseKey = String.format("%s@%d", prefix, i + 1);
+                        if (cnt > 0) {
+                            featMap.put(baseKey + "@cnt", FeatureUtils.log1(cnt));
+                        }
+                        if (uv > 0) {
+                            featMap.put(baseKey + "@uv", FeatureUtils.log1(uv));
+                        }
+                        if (ts > 0) {
+                            featMap.put(baseKey + "@ts", 1 - FeatureUtils.getTimeDiff(currentMs, ts * 1000));
+                        }
+                        if (null != hVideoMap && hVideoMap.containsKey(vid)) {
+                            Map<String, String> hVideo = hVideoMap.get(vid);
+                            //getVideoCateFeature(baseKey, hVideo, featMap);
+                            getTwoVideoCrossFeature(baseKey, hVideoSimAttrs, hVideo, rankVideo, featMap);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private static void getVideoAttrSRCrossFeature(String prefix, String attr, Map<String, VideoAttrSRBO> attrMap, Map<String, Double> featMap) {
+        if (null == attrMap || attrMap.isEmpty()) {
+            return;
+        }
+        if (attrMap.containsKey(attr)) {
+            VideoAttrSRBO bo = attrMap.get(attr);
+            if (null != bo) {
+                long sp = bo.getSp();    // share_pv
+                long rp = bo.getRp();    // return_n_pv_noself
+                long ru = bo.getRu();    // return_n_uv_noself
+                long mu = bo.getMu();    // max_return_uv
+                if (sp > 0) {
+                    double sp_s = FeatureUtils.log1(sp);
+                    double rp_s = FeatureUtils.log1(rp);
+                    double ru_s = FeatureUtils.log1(ru);
+                    double mu_s = FeatureUtils.log1(mu);
+
+                    double ros_one = FeatureUtils.wilsonScore(rp, sp);
+                    double ros = FeatureUtils.plusSmooth(ru, sp, smoothPlus);
+                    double ros_minus = FeatureUtils.plusSmooth(ru, rp, smoothPlus);
+
+                    featMap.put(prefix + "@sp", sp_s);
+                    featMap.put(prefix + "@rp", rp_s);
+                    featMap.put(prefix + "@ru", ru_s);
+                    featMap.put(prefix + "@mu", mu_s);
+                    featMap.put(prefix + "@ros_one", ros_one);
+                    featMap.put(prefix + "@ros", ros);
+                    featMap.put(prefix + "@ros_minus", ros_minus);
+                }
+            }
+        }
+    }
+
+    private static void getVideoCateFeature(String prefix, Map<String, String> videoInfo, Map<String, Double> featMap) {
+        if (null == videoInfo || videoInfo.isEmpty()) {
+            return;
+        }
+        for (String attr : videoCateAttrs) {
+            String attrVal = videoInfo.getOrDefault(attr, "");
+            int attrId = FeatureUtils.getAttrId(attr, attrVal);
+            if (attrId > 0) {
+                String key = String.format("%s@%s@%d", prefix, attr, attrId);
+                featMap.put(key, 1.0);
+            }
+        }
+    }
+
+    private static void getTwoVideoCrossFeature(String prefix, List<String> attrs, Map<String, String> video1, Map<String, String> video2, Map<String, Double> featMap) {
+        if (null == video1 || video1.isEmpty() || null == video2 || video2.isEmpty()) {
+            return;
+        }
+        for (String attr : attrs) {
+            String attr1 = video1.getOrDefault(attr, "");
+            String attr2 = video2.getOrDefault(attr, "");
+            if (!"".equals(attr1) && !"unknown".equals(attr1) && !"".equals(attr2) && !"unknown".equals(attr2)) {
+                double simScore = SimilarityUtils.word2VecSimilarity(attr1, attr2);
+                featMap.put(prefix + "_" + attr, simScore);
+            }
+        }
+    }
+
+    private static void headVideoCFD1Feature(String prefix, Map<String, String> infoMap, Map<String, Double> featMap) {
+        double ros_cf_score = getOneInfo("ros_cf_score", infoMap);
+        double ros_cf_rank = getOneInfo("ros_cf_rank", infoMap);
+        double rov_cf_score = getOneInfo("rov_cf_score", infoMap);
+        double rov_cf_rank = getOneInfo("rov_cf_rank", infoMap);
+        featMap.put(prefix + "_ros_cf_score", ros_cf_score);
+        featMap.put(prefix + "_ros_cf_rank", ros_cf_rank);
+        featMap.put(prefix + "_rov_cf_score", rov_cf_score);
+        featMap.put(prefix + "_rov_cf_rank", rov_cf_rank);
+    }
+
+    private static void headVideoCFD2Feature(String prefix, Map<String, String> infoMap, Map<String, Double> featMap) {
+        double score = getOneInfo("score", infoMap);
+        double rank = getOneInfo("rank", infoMap);
+        double onlines = getOneInfo("onlines", infoMap);
+        featMap.put(prefix + "_score", score);
+        featMap.put(prefix + "_rank", rank);
+        featMap.put(prefix + "_onlines", onlines);
+    }
+
+    private static void headVideoCFD3Feature(String prefix, Map<String, String> infoMap, Map<String, Double> featMap) {
+        double exp = getOneInfo("exp", infoMap);
+        double return_n = getOneInfo("return_n", infoMap);
+        double rovn = getOneInfo("rovn", infoMap);
+        featMap.put(prefix + "_exp", FeatureUtils.log1(exp));
+        featMap.put(prefix + "_return_n", FeatureUtils.log1(return_n));
+        featMap.put(prefix + "_rovn", rovn);
+    }
+
+    public static Map<String, Map<String, String[]>> parseUCFScore(Map<String, String> mapInfo) {
+        Map<String, Map<String, String[]>> allScoresMap = new HashMap<>();
+        for (String cfType : cfList) {
+            String data = mapInfo.getOrDefault(cfType, "");
+            if (!data.isEmpty()) {
+                Map<String, String[]> oneScoresMap = new HashMap<>();
+                String[] entries = data.split(",");
+                for (String entry : entries) {
+                    String[] rList = entry.split(":");
+                    if (rList.length >= 4) { // 确保分割后有四个元素
+                        String key = rList[0];
+                        String value1 = rList[1];
+                        String value2 = rList[2];
+                        String value3 = rList[3];
+                        String[] strs = {value1, value2, value3};
+                        oneScoresMap.put(key, strs);
+                    }
+                }
+                if (!oneScoresMap.isEmpty()) {
+                    allScoresMap.put(cfType, oneScoresMap);
+                }
+            }
+        }
+        return allScoresMap;
+    }
+
+    private static void getRateStatFeature(String prefix, String calType, List<String> periods, Map<String, String> infoMap, Map<String, Double> featMap) {
+        if (null == infoMap || infoMap.isEmpty()) {
+            return;
+        }
+        for (String period : periods) {
+            double str_one = getOneInfo(calType + "str_one_" + period, infoMap);
+            double ros_one = getOneInfo(calType + "ros_one_" + period, infoMap);
+            double str = getOneInfo(calType + "str_" + period, infoMap);
+            double ros = getOneInfo(calType + "ros_" + period, infoMap);
+            double str_plus = getOneInfo(calType + "str_plus_" + period, infoMap);
+            double ros_minus = getOneInfo(calType + "ros_minus_" + period, infoMap);
+            double rovn = getOneInfo(calType + "rovn_" + period, infoMap);
+
+            featMap.put(prefix + "_" + period + "_" + calType + "str_one", str_one);
+            featMap.put(prefix + "_" + period + "_" + calType + "ros_one", ros_one);
+            featMap.put(prefix + "_" + period + "_" + calType + "str", str);
+            featMap.put(prefix + "_" + period + "_" + calType + "ros", ros);
+            featMap.put(prefix + "_" + period + "_" + calType + "str_plus", str_plus);
+            featMap.put(prefix + "_" + period + "_" + calType + "ros_minus", ros_minus);
+            featMap.put(prefix + "_" + period + "_" + calType + "rovn", rovn);
+        }
+    }
+
+    private static void oneTypeStatFeature(String prefix, String uvPrefix, List<String> periods, Map<String, String> infoMap, Map<String, Double> featMap) {
+        if (null == infoMap || infoMap.isEmpty()) {
+            return;
+        }
+        for (String period : periods) {
+            double exp = getOneInfo("exp_" + period, infoMap);
+            if (!FeatureUtils.greaterThanZero(exp)) {
+                continue;
+            }
+            double is_share = getOneInfo("is_share_" + period, infoMap);
+            double share_cnt = getOneInfo("share_cnt_" + period, infoMap);
+            double is_return_1 = getOneInfo("is_return_1_" + period, infoMap);
+            double return_n_uv = getOneInfo(uvPrefix + "_" + period, infoMap);
+
+            double exp_s = FeatureUtils.log1(exp);
+            double is_share_s = FeatureUtils.log1(is_share);
+            double share_cnt_s = FeatureUtils.log1(share_cnt);
+            double is_return_1_s = FeatureUtils.log1(is_return_1);
+            double return_n_uv_s = FeatureUtils.log1(return_n_uv);
+
+            double str = FeatureUtils.wilsonScore(is_share, exp);
+            double str_plus = FeatureUtils.wilsonScore(is_return_1, exp);
+            double ros_one = FeatureUtils.wilsonScore(is_return_1, is_share);
+
+            double rovn = FeatureUtils.plusSmooth(return_n_uv, exp, smoothPlus);
+            double ros = FeatureUtils.plusSmooth(return_n_uv, is_share, smoothPlus);
+            double ros_n = FeatureUtils.plusSmooth(return_n_uv, share_cnt, smoothPlus);
+            double ros_minus = FeatureUtils.plusSmooth(return_n_uv, is_return_1, smoothPlus);
+
+            featMap.put(prefix + "_" + period + "_" + "exp", exp_s);
+            featMap.put(prefix + "_" + period + "_" + "is_share", is_share_s);
+            featMap.put(prefix + "_" + period + "_" + "share_cnt", share_cnt_s);
+            featMap.put(prefix + "_" + period + "_" + "is_return_1", is_return_1_s);
+            featMap.put(prefix + "_" + period + "_" + "return_n_uv", return_n_uv_s);
+            featMap.put(prefix + "_" + period + "_" + "str", str);
+            featMap.put(prefix + "_" + period + "_" + "str_plus", str_plus);
+            featMap.put(prefix + "_" + period + "_" + "ros_one", ros_one);
+            featMap.put(prefix + "_" + period + "_" + "rovn", rovn);
+            featMap.put(prefix + "_" + period + "_" + "ros", ros);
+            featMap.put(prefix + "_" + period + "_" + "ros_n", ros_n);
+            featMap.put(prefix + "_" + period + "_" + "ros_minus", ros_minus);
+        }
+    }
+
+    private static double getOneInfo(String name, Map<String, String> map) {
+        if (null == map) {
+            return 0.0;
+        }
+        return map.isEmpty() ? 0 : Double.parseDouble(map.getOrDefault(name, "0.0"));
+    }
+}

+ 1 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/score/ScorerUtils.java

@@ -35,7 +35,7 @@ public final class ScorerUtils {
         ScorerUtils.init("feeds_score_config_20240807.conf");
         ScorerUtils.init("feeds_score_config_fm_xgb_20241209.conf");
         ScorerUtils.init("feeds_score_config_fm_xgb_20250208.conf");
-        ScorerUtils.init("feeds_score_config_fm_xgb_20250218.conf");
+        ScorerUtils.init("feeds_score_config_fm_xgb_20250221.conf");
         ScorerUtils.init("feeds_score_config_xgb_20241209.conf");
         ScorerUtils.init("feeds_score_config_xgb_20250109.conf");
         ScorerUtils.init("feeds_score_config_xgb_rov_20241209.conf");

+ 65 - 3
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/util/FeatureUtils.java

@@ -2,6 +2,8 @@ package com.tzld.piaoquan.recommend.server.util;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class FeatureUtils {
     public static final String cate1Attr = "cate1_list";
@@ -10,7 +12,14 @@ public class FeatureUtils {
     private static final Map<String, Integer> cate1MAP = new HashMap<>();
     private static final Map<String, Integer> cate2MAP = new HashMap<>();
     private static final Map<String, Integer> festive1Map = new HashMap<>();
-    public static final double oneYearMs = 365 * 24 * 3600 * 1000.0;
+    public static final double twoMonthMs = 2 * 30 * 24 * 3600 * 1000.0;
+
+    private static final String goodMorningRegex = "(早安|早上好|早晨好|上午好)";
+    private static final String goodAfternoonRegex = "(午安|中午好|下午好)";
+    private static final String goodEveningRegex = "(晚安|晚上好)";
+    private static final Pattern goodMorningPattern = Pattern.compile(goodMorningRegex);
+    private static final Pattern goodAfternoonPattern = Pattern.compile(goodAfternoonRegex);
+    private static final Pattern goodEveningPattern = Pattern.compile(goodEveningRegex);
 
     static {
         cate1MAP.put("情感", 1);
@@ -77,11 +86,64 @@ public class FeatureUtils {
         }
     }
 
-    public static double getCreateTime(long currentMs, long createMs) {
-        double diff = (currentMs - createMs) / oneYearMs;
+    public static int judgeVideoTimeType(String s) {
+        if (null != s && !s.isEmpty()) {
+            Matcher morning = goodMorningPattern.matcher(s);
+            if (morning.find()) {
+                return 1;
+            }
+//            Matcher afternoon = goodAfternoonPattern.matcher(s);
+//            if (afternoon.find()) {
+//                return 2;
+//            }
+//            Matcher evening = goodEveningPattern.matcher(s);
+//            if (evening.find()) {
+//                return 3;
+//            }
+        }
+        return 0;
+    }
+
+    public static double getTimeDiff(long currentMs, long historyMs) {
+        double diff = (currentMs - historyMs) / twoMonthMs;
         if (diff > 1.0) {
             diff = 1.0;
         }
         return diff;
     }
+
+    public static double log1(double data) {
+        if (data <= 0) {
+            return 0D;
+        }
+        return Math.log(data + 1.0);
+    }
+
+    public static double plusSmooth(double a, double b, double plus) {
+        if (a == 0 || b == 0) {
+            return 0D;
+        }
+        return a / (b + plus);
+    }
+
+    public static double wilsonScore(double click, double exposure) {
+        if (exposure <= 0) {
+            return 0.0;
+        }
+
+        double z = 1.96;
+        double ctr = click / exposure;
+        if (ctr > 1.0) {
+            ctr = 1.0;
+        }
+
+        double numerator_1 = ctr + Math.pow(z, 2) / (2 * exposure);
+        double numerator_2 = z * Math.sqrt((ctr * (1 - ctr)) / exposure + Math.pow(z / (2 * exposure), 2));
+        double denominator = 1.0 + Math.pow(z, 2) / exposure;
+        return (numerator_1 - numerator_2) / denominator;
+    }
+
+    public static boolean greaterThanZero(double value) {
+        return value > 1E-8;
+    }
 }

+ 444 - 0
recommend-server-service/src/main/resources/feeds_score_config_fm_xgb_20250221.conf

@@ -0,0 +1,444 @@
+scorer-config = {
+  rov-score-config = {
+     scorer-name = "com.tzld.piaoquan.recommend.server.service.score.VlogRovFMScorer"
+     scorer-priority = 96
+     model-path = "zhangbo/model_aka8_new2.txt"
+  }
+  nor-score-config = {
+    scorer-name = "com.tzld.piaoquan.recommend.server.service.score.NorXGBRegressionScorer"
+    scorer-priority = 97
+    model-path = "zhangbo/model_xgb_for_recsys_v4_nor.tar.gz"
+    param = {
+      localDir = "xgboost/recsys_v4_nor"
+      features = [
+      "b10_12h_is_share",
+      "b10_12h_return_n_uv",
+      "b10_12h_ros",
+      "b10_12h_ros_minus",
+      "b10_12h_rovn",
+      "b10_12h_str",
+      "b10_12h_str_plus",
+      "b10_1h_is_share",
+      "b10_1h_return_n_uv",
+      "b10_1h_ros",
+      "b10_1h_ros_minus",
+      "b10_1h_rovn",
+      "b10_1h_str",
+      "b10_1h_str_plus",
+      "b11_12h_is_share",
+      "b11_12h_return_n_uv",
+      "b11_12h_ros",
+      "b11_12h_ros_minus",
+      "b11_12h_rovn",
+      "b11_12h_str",
+      "b11_12h_str_plus",
+      "b11_168h_is_share",
+      "b11_168h_return_n_uv",
+      "b11_168h_ros",
+      "b11_168h_ros_minus",
+      "b11_168h_rovn",
+      "b11_168h_str",
+      "b11_168h_str_plus",
+      "b13_168h_is_share",
+      "b13_168h_return_n_uv",
+      "b13_168h_ros",
+      "b13_168h_ros_minus",
+      "b13_168h_ros_n",
+      "b13_168h_ros_one",
+      "b13_168h_rovn",
+      "b13_168h_str",
+      "b13_168h_str_plus",
+      "b13_24h_is_share",
+      "b13_24h_return_n_uv",
+      "b13_24h_ros",
+      "b13_24h_ros_minus",
+      "b13_24h_ros_n",
+      "b13_24h_ros_one",
+      "b13_24h_rovn",
+      "b13_24h_str",
+      "b13_24h_str_plus",
+      "b1_168h_exp",
+      "b1_168h_is_return_1",
+      "b1_168h_is_share",
+      "b1_168h_return_n_uv",
+      "b1_168h_ros",
+      "b1_168h_ros_minus",
+      "b1_168h_ros_n",
+      "b1_168h_ros_one",
+      "b1_168h_rovn",
+      "b1_168h_share_cnt",
+      "b1_168h_str",
+      "b1_168h_str_plus",
+      "b1_1h_exp",
+      "b1_1h_is_return_1",
+      "b1_1h_is_share",
+      "b1_1h_return_n_uv",
+      "b1_1h_ros",
+      "b1_1h_ros_minus",
+      "b1_1h_ros_n",
+      "b1_1h_ros_one",
+      "b1_1h_rovn",
+      "b1_1h_share_cnt",
+      "b1_1h_str",
+      "b1_1h_str_plus",
+      "b1_24h_exp",
+      "b1_24h_is_return_1",
+      "b1_24h_is_share",
+      "b1_24h_return_n_uv",
+      "b1_24h_ros",
+      "b1_24h_ros_minus",
+      "b1_24h_ros_n",
+      "b1_24h_ros_one",
+      "b1_24h_rovn",
+      "b1_24h_share_cnt",
+      "b1_24h_str",
+      "b1_24h_str_plus",
+      "b1_3h_exp",
+      "b1_3h_is_return_1",
+      "b1_3h_is_share",
+      "b1_3h_return_n_uv",
+      "b1_3h_ros",
+      "b1_3h_ros_minus",
+      "b1_3h_ros_n",
+      "b1_3h_ros_one",
+      "b1_3h_rovn",
+      "b1_3h_share_cnt",
+      "b1_3h_str",
+      "b1_3h_str_plus",
+      "b1_72h_exp",
+      "b1_72h_is_return_1",
+      "b1_72h_is_share",
+      "b1_72h_return_n_uv",
+      "b1_72h_ros",
+      "b1_72h_ros_minus",
+      "b1_72h_ros_n",
+      "b1_72h_ros_one",
+      "b1_72h_rovn",
+      "b1_72h_share_cnt",
+      "b1_72h_str",
+      "b1_72h_str_plus",
+      "b2_1h_is_return_1",
+      "b2_1h_is_share",
+      "b2_1h_return_n_uv",
+      "b2_1h_ros",
+      "b2_1h_ros_minus",
+      "b2_1h_ros_n",
+      "b2_1h_ros_one",
+      "b2_1h_rovn",
+      "b2_1h_share_cnt",
+      "b2_1h_str",
+      "b2_1h_str_plus",
+      "b2_24h_is_return_1",
+      "b2_24h_is_share",
+      "b2_24h_return_n_uv",
+      "b2_24h_ros",
+      "b2_24h_ros_minus",
+      "b2_24h_ros_n",
+      "b2_24h_ros_one",
+      "b2_24h_rovn",
+      "b2_24h_share_cnt",
+      "b2_24h_str",
+      "b2_24h_str_plus",
+      "b2_3h_is_return_1",
+      "b2_3h_is_share",
+      "b2_3h_return_n_uv",
+      "b2_3h_ros",
+      "b2_3h_ros_minus",
+      "b2_3h_ros_n",
+      "b2_3h_ros_one",
+      "b2_3h_rovn",
+      "b2_3h_share_cnt",
+      "b2_3h_str",
+      "b2_3h_str_plus",
+      "b3_168h_is_return_1",
+      "b3_168h_is_share",
+      "b3_168h_return_n_uv",
+      "b3_168h_ros",
+      "b3_168h_ros_minus",
+      "b3_168h_ros_n",
+      "b3_168h_ros_one",
+      "b3_168h_rovn",
+      "b3_168h_share_cnt",
+      "b3_168h_str",
+      "b3_168h_str_plus",
+      "b3_24h_is_return_1",
+      "b3_24h_is_share",
+      "b3_24h_return_n_uv",
+      "b3_24h_ros",
+      "b3_24h_ros_minus",
+      "b3_24h_ros_n",
+      "b3_24h_ros_one",
+      "b3_24h_rovn",
+      "b3_24h_share_cnt",
+      "b3_24h_str",
+      "b3_24h_str_plus",
+      "b4_12h_is_return_1",
+      "b4_12h_is_share",
+      "b4_12h_return_n_uv",
+      "b4_12h_ros",
+      "b4_12h_ros_minus",
+      "b4_12h_ros_n",
+      "b4_12h_ros_one",
+      "b4_12h_rovn",
+      "b4_12h_share_cnt",
+      "b4_12h_str",
+      "b4_12h_str_plus",
+      "b4_1h_is_return_1",
+      "b4_1h_is_share",
+      "b4_1h_return_n_uv",
+      "b4_1h_ros",
+      "b4_1h_ros_minus",
+      "b4_1h_ros_n",
+      "b4_1h_ros_one",
+      "b4_1h_rovn",
+      "b4_1h_share_cnt",
+      "b4_1h_str",
+      "b4_1h_str_plus",
+      "b5_168h_is_share",
+      "b5_168h_return_n_uv",
+      "b5_168h_ros",
+      "b5_168h_ros_minus",
+      "b5_168h_ros_n",
+      "b5_168h_ros_one",
+      "b5_168h_rovn",
+      "b5_168h_str",
+      "b5_168h_str_plus",
+      "b5_72h_is_share",
+      "b5_72h_return_n_uv",
+      "b5_72h_ros",
+      "b5_72h_ros_minus",
+      "b5_72h_ros_n",
+      "b5_72h_ros_one",
+      "b5_72h_rovn",
+      "b5_72h_str",
+      "b5_72h_str_plus",
+      "b6_1h_is_share",
+      "b6_1h_return_n_uv",
+      "b6_1h_ros",
+      "b6_1h_ros_minus",
+      "b6_1h_ros_n",
+      "b6_1h_ros_one",
+      "b6_1h_rovn",
+      "b6_1h_str",
+      "b6_1h_str_plus",
+      "b6_24h_is_share",
+      "b6_24h_return_n_uv",
+      "b6_24h_ros",
+      "b6_24h_ros_minus",
+      "b6_24h_ros_n",
+      "b6_24h_ros_one",
+      "b6_24h_rovn",
+      "b6_24h_str",
+      "b6_24h_str_plus",
+      "b7_168h_is_share",
+      "b7_168h_return_n_uv",
+      "b7_168h_ros",
+      "b7_168h_ros_minus",
+      "b7_168h_rovn",
+      "b7_168h_str",
+      "b7_168h_str_plus",
+      "b7_24h_is_share",
+      "b7_24h_return_n_uv",
+      "b7_24h_ros",
+      "b7_24h_ros_minus",
+      "b7_24h_rovn",
+      "b7_24h_str",
+      "b7_24h_str_plus",
+      "b8_24h_is_share",
+      "b8_24h_return_n_uv",
+      "b8_24h_ros",
+      "b8_24h_ros_minus",
+      "b8_24h_rovn",
+      "b8_24h_str",
+      "b8_24h_str_plus",
+      "b9_24h_is_share",
+      "b9_24h_return_n_uv",
+      "b9_24h_ros",
+      "b9_24h_ros_minus",
+      "b9_24h_rovn",
+      "b9_24h_str",
+      "b9_24h_str_plus",
+      "c1_168h_is_return_1",
+      "c1_168h_is_share",
+      "c1_168h_return_n_uv",
+      "c1_168h_ros",
+      "c1_168h_ros_minus",
+      "c1_168h_ros_n",
+      "c1_168h_ros_one",
+      "c1_168h_rovn",
+      "c1_168h_share_cnt",
+      "c1_168h_str",
+      "c1_168h_str_plus",
+      "c1_72h_is_return_1",
+      "c1_72h_is_share",
+      "c1_72h_return_n_uv",
+      "c1_72h_ros",
+      "c1_72h_ros_minus",
+      "c1_72h_ros_n",
+      "c1_72h_ros_one",
+      "c1_72h_rovn",
+      "c1_72h_share_cnt",
+      "c1_72h_str",
+      "c1_72h_str_plus",
+      "c4_168h_avg_ros",
+      "c4_168h_avg_ros_minus",
+      "c4_168h_avg_ros_one",
+      "c4_168h_avg_rovn",
+      "c4_168h_avg_str",
+      "c4_168h_avg_str_one",
+      "c4_168h_avg_str_plus",
+      "c4_168h_max_ros",
+      "c4_168h_max_ros_minus",
+      "c4_168h_max_ros_one",
+      "c4_168h_max_rovn",
+      "c4_168h_max_str",
+      "c4_168h_max_str_one",
+      "c4_168h_max_str_plus",
+      "c4_168h_min_ros",
+      "c4_168h_min_ros_minus",
+      "c4_168h_min_ros_one",
+      "c4_168h_min_rovn",
+      "c4_168h_min_str",
+      "c4_168h_min_str_one",
+      "c4_168h_min_str_plus",
+      "c4_72h_avg_ros",
+      "c4_72h_avg_ros_minus",
+      "c4_72h_avg_ros_one",
+      "c4_72h_avg_rovn",
+      "c4_72h_avg_str",
+      "c4_72h_avg_str_one",
+      "c4_72h_avg_str_plus",
+      "c4_72h_max_ros",
+      "c4_72h_max_ros_minus",
+      "c4_72h_max_ros_one",
+      "c4_72h_max_rovn",
+      "c4_72h_max_str",
+      "c4_72h_max_str_one",
+      "c4_72h_max_str_plus",
+      "c4_72h_min_ros",
+      "c4_72h_min_ros_minus",
+      "c4_72h_min_ros_one",
+      "c4_72h_min_rovn",
+      "c4_72h_min_str",
+      "c4_72h_min_str_one",
+      "c4_72h_min_str_plus",
+      "c5_tags_1d_avgscore",
+      "c5_tags_1d_matchnum",
+      "c5_tags_1d_maxscore",
+      "c5_tags_3d_avgscore",
+      "c5_tags_3d_matchnum",
+      "c5_tags_3d_maxscore",
+      "c5_tags_7d_avgscore",
+      "c5_tags_7d_matchnum",
+      "c5_tags_7d_maxscore",
+      "c6_tags_1d_avgscore",
+      "c6_tags_1d_matchnum",
+      "c6_tags_1d_maxscore",
+      "c6_tags_3d_avgscore",
+      "c6_tags_3d_matchnum",
+      "c6_tags_3d_maxscore",
+      "c6_tags_7d_avgscore",
+      "c6_tags_7d_matchnum",
+      "c6_tags_7d_maxscore",
+      "c7_return_num",
+      "c7_return_rank",
+      "c7_return_score",
+      "c7_share_num",
+      "c7_share_rank",
+      "c7_share_score",
+      "c8_return_num",
+      "c8_return_rank",
+      "c8_return_score",
+      "c8_share_num",
+      "c8_share_rank",
+      "c8_share_score",
+      "c9_c1s@mu",
+      "c9_c1s@ros",
+      "c9_c1s@ros_minus",
+      "c9_c1s@ros_one",
+      "c9_c1s@rp",
+      "c9_c1s@ru",
+      "c9_c1s@sp",
+      "c9_c2s@mu",
+      "c9_c2s@ros",
+      "c9_c2s@ros_minus",
+      "c9_c2s@ros_one",
+      "c9_c2s@rp",
+      "c9_c2s@ru",
+      "c9_c2s@sp",
+      "c9_l1s@mu",
+      "c9_l1s@ros",
+      "c9_l1s@ros_minus",
+      "c9_l1s@ros_one",
+      "c9_l1s@rp",
+      "c9_l1s@ru",
+      "c9_l1s@sp",
+      "c9_l2s@mu",
+      "c9_l2s@ros",
+      "c9_l2s@ros_minus",
+      "c9_l2s@ros_one",
+      "c9_l2s@rp",
+      "c9_l2s@ru",
+      "c9_l2s@sp",
+      "c9_lrs@1@ts",
+      "c9_lrs@1@uv",
+      "c9_lrs@1_title",
+      "c9_lrs@2@ts",
+      "c9_lrs@2@uv",
+      "c9_lrs@2_title",
+      "c9_lss@1@cnt",
+      "c9_lss@1@ts",
+      "c9_lss@1_title",
+      "c9_lss@2@cnt",
+      "c9_lss@2@ts",
+      "c9_lss@2_title",
+      "c9_m_r_uv",
+      "c9_m_s_cnt",
+      "c9_mrs@1@ts",
+      "c9_mrs@1@uv",
+      "c9_mrs@1_title",
+      "c9_mrs@2@ts",
+      "c9_mrs@2@uv",
+      "c9_mrs@2_title",
+      "c9_mss@1@cnt",
+      "c9_mss@1@ts",
+      "c9_mss@1_title",
+      "c9_mss@2@cnt",
+      "c9_mss@2@ts",
+      "c9_mss@2_title",
+      "c9_r_pv",
+      "c9_r_uv",
+      "c9_ros",
+      "c9_ros_minus",
+      "c9_ros_one",
+      "c9_s_cnt",
+      "c9_s_pv",
+      "d1_ros_cf_rank",
+      "d1_ros_cf_score",
+      "d1_rov_cf_rank",
+      "d1_rov_cf_score",
+      "d2_onlines",
+      "d2_rank",
+      "d2_score",
+      "d3_exp",
+      "d3_return_n",
+      "d3_rovn",
+      "h@bit_rate",
+      "h@total_time",
+      "h@ts",
+      "h@tt@1",
+      "hour",
+      "hr_sim_cate1_list",
+      "hr_sim_cate2",
+      "hr_sim_cate2_list",
+      "hr_sim_keywords",
+      "hr_sim_title",
+      "hr_sim_topic",
+      "r@bit_rate",
+      "r@total_time",
+      "r@ts",
+      "r@tt@1"
+      ]
+    }
+  }
+}