Prechádzať zdrojové kódy

Merge branch 'feature/str_rank_v7' of algorithm/recommend-server into master

jiachanghui 2 dní pred
rodič
commit
d4e15361d2

+ 5 - 18
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/RecommendService.java

@@ -40,7 +40,6 @@ import javax.annotation.PostConstruct;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Consumer;
-import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
 /**
@@ -539,24 +538,12 @@ public class RecommendService {
     }
 
     private String getChannelName(String s) {
-        Matcher matcher = FeatureUtils.getChannelMatcher(s);
-        if (null != matcher && matcher.find()) {
-            switch (matcher.group(0)) {
-                case "longArticles_":
-                    return getChannelType(s);
-                case "dyyjs_":
-                    return "公众号代运营-即转";
-                case "touliu_tencent_":
-                    return "小程序投流";
-                case "touliu_tencentgzh_":
-                case "touliu_tencentGzhArticle_":
-                case "GzhTouLiu_Articles_gh":
-                    return "公众号投流";
-                default:
-                    return "";
-            }
+        String channel = FeatureUtils.getUserChannel(s);
+        if (channel.equals("公众号mix")) {
+            return getChannelType(s);
+        } else {
+            return channel;
         }
-        return "";
     }
 
     private String getChannelType(String s) {

+ 35 - 3
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/strategy/RankStrategy4RegionMergeModelV566.java

@@ -16,11 +16,14 @@ 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.JSONUtils;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
@@ -34,11 +37,25 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
     @ApolloJsonValue("${rank.score.merge.weightv566:}")
     private Map<String, Double> mergeWeight;
 
+    @Value("#{'${rootsessionid.tails.566:}'.split(',')}")
+    private Set<String> rootSessionIdTails;
+
     @Autowired
     private FeatureService featureService;
 
+    @Autowired
+    private RankStrategy4RegionMergeModelV567 modelV567;
+
     @Override
     public List<Video> mergeAndRankRovRecall(RankParam param) {
+        String rootSessionId = param.getRootSessionId();
+        if (StringUtils.isBlank(rootSessionId) || CollectionUtils.isEmpty(rootSessionIdTails)) {
+            return modelV567.mergeAndRankRovRecall(param);
+        }
+        String tail = rootSessionId.substring(rootSessionId.length() - 1);
+        if (!rootSessionIdTails.contains(tail)) {
+            return modelV567.mergeAndRankRovRecall(param);
+        }
         Map<String, Double> mergeWeight = this.mergeWeight != null ? this.mergeWeight : new HashMap<>(0);
 
         //-------------------融-------------------
@@ -99,13 +116,21 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
         int headCate2RecallN = mergeWeight.getOrDefault("headCate2RecallN", 3.0).intValue();
         addRecall(param, headCate2RecallN, HeadProvinceCate2RecallStrategy.PUSH_FORM, setVideo, rovRecallRank);
         //-------------------head cate2 of rovn------------------
-        List<Video> headCate2Rov = extractAndSort(param, HeadCate2AndChannelRovRecallStrategy.PUSH_FROM);
+        List<Video> headCate2Rov = extractAndSort(param, HeadCate2RovRecallStrategy.PUSH_FROM);
         // 视频去重
         removeDuplicate(headCate2Rov);
         headCate2Rov = headCate2Rov.stream().filter(o -> !setVideo.contains(o.getVideoId())).collect(Collectors.toList());
-        headCate2Rov = headCate2Rov.subList(0, Math.min(mergeWeight.getOrDefault("headCate2AndChannelRov", 5.0).intValue(), headCate2Rov.size()));
+        headCate2Rov = headCate2Rov.subList(0, Math.min(mergeWeight.getOrDefault("headCate2Rov", 5.0).intValue(), headCate2Rov.size()));
         rovRecallRank.addAll(headCate2Rov);
         setVideo.addAll(headCate2Rov.stream().map(Video::getVideoId).collect(Collectors.toSet()));
+        //------------------- head cate2 and channel of rovn------------------
+        List<Video> headCate2AndChannelRov = extractAndSort(param, HeadCate2AndChannelRovRecallStrategy.PUSH_FROM);
+        // 视频去重
+        removeDuplicate(headCate2AndChannelRov);
+        headCate2AndChannelRov = headCate2AndChannelRov.stream().filter(o -> !setVideo.contains(o.getVideoId())).collect(Collectors.toList());
+        headCate2AndChannelRov = headCate2AndChannelRov.subList(0, Math.min(mergeWeight.getOrDefault("headCate2AndChannelRov", 5.0).intValue(), headCate2AndChannelRov.size()));
+        rovRecallRank.addAll(headCate2AndChannelRov);
+        setVideo.addAll(headCate2AndChannelRov.stream().map(Video::getVideoId).collect(Collectors.toSet()));
 
         //-------------------排-------------------
         //-------------------序-------------------
@@ -136,7 +161,7 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
 
         // 4. 排序模型计算
         Map<String, String> sceneFeatureMap = new HashMap<>(0);
-        List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_fm_xgb_20250317.conf").scoring(sceneFeatureMap, userFeatureMap, userFeatureMap, rankItems);
+        List<RankItem> items = ScorerUtils.getScorerPipeline("feeds_score_config_fm_xgb_20250423.conf").scoring(sceneFeatureMap, userFeatureMap, userFeatureMap, rankItems);
 
         // 5. 排序公式特征
         double xgbRovNegRate = mergeWeight.getOrDefault("xgbRovNegRate", 0.059);
@@ -369,6 +394,13 @@ public class RankStrategy4RegionMergeModelV566 extends RankStrategy4RegionMergeM
                 baseInfo.put("system", system);
             }
         }
+        String userChannel = param.getChannelName();
+        if (null != userChannel && !userChannel.isEmpty()) {
+            baseInfo.put("user_channel", userChannel);
+        }
+        if (FeatureUtils.firstLevel(param.getUserShareDepth())) {
+            baseInfo.put("user_level", "1st");
+        }
         return baseInfo;
     }
 

+ 1 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/tansform/FeatureV6.java

@@ -32,7 +32,7 @@ public class FeatureV6 {
     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");
-    private static final List<String> userAttrList = Arrays.asList("province", "city", "model", "brand", "system");
+    private static final List<String> userAttrList = Arrays.asList("province", "city", "model", "brand", "system", "user_channel", "user_level");
     private static final Set<String> hotSceneSet = new HashSet<>(Arrays.asList("1008", "1007", "1058", "1074", "1010"));
 
     public static void getContextFeature(long currentMs, String appType, String hotSceneType, Map<String, Double> featureMap) {

+ 5 - 33
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/recall/RecallService.java

@@ -108,41 +108,13 @@ public class RecallService implements ApplicationContextAware {
         strategies.add(strategyMap.get(ReturnVideoRecallStrategy.class.getSimpleName()));
         strategies.add(strategyMap.get(SceneCFRovnRecallStrategy.class.getSimpleName()));
         strategies.add(strategyMap.get(SceneCFRosnRecallStrategy.class.getSimpleName()));
+        strategies.add(strategyMap.get(UserCate1RecallStrategy.class.getSimpleName()));
+        strategies.add(strategyMap.get(UserCate2RecallStrategy.class.getSimpleName()));
+        strategies.add(strategyMap.get(HeadProvinceCate1RecallStrategy.class.getSimpleName()));
+        strategies.add(strategyMap.get(HeadProvinceCate2RecallStrategy.class.getSimpleName()));
+        strategies.add(strategyMap.get(HeadCate2RovRecallStrategy.class.getSimpleName()));
         Set<String> abExpCodes = param.getAbExpCodes();
-        if (CollectionUtils.isNotEmpty(abExpCodes) && abExpCodes.contains("564")) {
-            strategies.add(strategyMap.get(UserCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(UserCate2RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate2RecallStrategy.class.getSimpleName()));
-        }
-        if (CollectionUtils.isNotEmpty(abExpCodes) && abExpCodes.contains("568")) {
-            strategies.add(strategyMap.get(UserCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(UserCate2RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate2RecallStrategy.class.getSimpleName()));
-        }
-
-        if (CollectionUtils.isNotEmpty(abExpCodes) && abExpCodes.contains("562")) {
-            strategies.add(strategyMap.get(UserCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(UserCate2RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate2RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadCate2RovRecallStrategy.class.getSimpleName()));
-        }
-
-        if (CollectionUtils.isNotEmpty(abExpCodes) && abExpCodes.contains("567")) {
-            strategies.add(strategyMap.get(UserCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(UserCate2RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate2RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadCate2RovRecallStrategy.class.getSimpleName()));
-        }
-
         if (CollectionUtils.isNotEmpty(abExpCodes) && abExpCodes.contains("566")) {
-            strategies.add(strategyMap.get(UserCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(UserCate2RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate1RecallStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HeadProvinceCate2RecallStrategy.class.getSimpleName()));
             strategies.add(strategyMap.get(HeadCate2AndChannelRovRecallStrategy.class.getSimpleName()));
         }
 

+ 0 - 134
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/recall/strategy/ChannelROVRecallStrategy.java

@@ -1,134 +0,0 @@
-package com.tzld.piaoquan.recommend.server.service.recall.strategy;
-
-import com.tzld.piaoquan.recommend.server.model.Video;
-import com.tzld.piaoquan.recommend.server.service.filter.FilterParam;
-import com.tzld.piaoquan.recommend.server.service.filter.FilterResult;
-import com.tzld.piaoquan.recommend.server.service.filter.FilterService;
-import com.tzld.piaoquan.recommend.server.service.recall.FilterParamFactory;
-import com.tzld.piaoquan.recommend.server.service.recall.RecallParam;
-import com.tzld.piaoquan.recommend.server.service.recall.RecallStrategy;
-import com.tzld.piaoquan.recommend.server.util.FeatureUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Component;
-
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.stream.Collectors;
-
-@Component
-@Slf4j
-public class ChannelROVRecallStrategy implements RecallStrategy {
-    private final String CLASS_NAME = this.getClass().getSimpleName();
-    @Autowired
-    private FilterService filterService;
-    @Autowired
-    @Qualifier("redisTemplate")
-    public RedisTemplate<String, String> redisTemplate;
-
-    public static final String channelGroupPrefix = "alg_recsys_user_channel_group";
-
-    public static final String PUSH_FORM = "recall_strategy_channel_rovn";
-    public static final String redisKeyPrefix = "channel_rovn_recall";
-
-    @Override
-    public String pushFrom() {
-        return PUSH_FORM;
-    }
-
-    @Override
-    public List<Video> recall(RecallParam param) {
-        List<Video> videosResult = new ArrayList<>();
-        try {
-            if (!FeatureUtils.firstLevel(param.getUserShareDepth())) {
-                return videosResult;
-            }
-
-            String channelName = getChannelName(param.getRootSourceId());
-            if (channelName.isEmpty()) {
-                return videosResult;
-            }
-
-            String key = String.format("%s:%s", redisKeyPrefix, channelName);
-            String value = redisTemplate.opsForValue().get(key);
-            if (null == value || value.isEmpty()) {
-                return videosResult;
-            }
-            List<Long> vidList = parseVidList(param.getVideoId(), value);
-            fillVideoResult(param, vidList, videosResult);
-        } catch (Exception e) {
-            log.error("recall is wrong in {}, error={}", CLASS_NAME, e);
-        }
-        return videosResult;
-    }
-
-    private List<Long> parseVidList(Long headVid, String data) {
-        List<Long> vidList = new ArrayList<>();
-        if (null != data && !data.isEmpty()) {
-            String[] pair = data.split("\t");
-            if (2 == pair.length) {
-                Set<Long> hit = new HashSet<>();
-                hit.add(headVid);
-                List<Long> ids = Arrays.stream(pair[0].split(",")).map(Long::valueOf).collect(Collectors.toList());
-                if (!ids.isEmpty()) {
-                    for (Long id : ids) {
-                        if (!hit.contains(id)) {
-                            hit.add(id);
-                            vidList.add(id);
-                        }
-                    }
-                }
-            }
-        }
-        return vidList;
-    }
-
-    private void fillVideoResult(RecallParam param, List<Long> vidList, List<Video> videosResult) {
-        FilterParam filterParam = FilterParamFactory.create(param, vidList);
-        FilterResult filterResult = filterService.filter(filterParam);
-        if (filterResult != null && CollectionUtils.isNotEmpty(filterResult.getVideoIds())) {
-            List<Long> filterIds = filterResult.getVideoIds();
-            int n = filterIds.size();
-            for (int i = 0; i < n; i++) {
-                Video video = new Video();
-                video.setVideoId(filterIds.get(i));
-                video.setRovScore(n - i);
-                video.setPushFrom(pushFrom());
-                videosResult.add(video);
-            }
-        }
-    }
-
-    private String getChannelName(String s) {
-        Matcher matcher = FeatureUtils.getChannelMatcher(s);
-        if (null != matcher && matcher.find()) {
-            switch (matcher.group(0)) {
-                case "longArticles_":
-                    return getChannelType(s);
-                case "dyyjs_":
-                    return "公众号代运营-即转";
-                case "touliu_tencent_":
-                    return "小程序投流";
-                case "touliu_tencentgzh_":
-                case "touliu_tencentGzhArticle_":
-                case "GzhTouLiu_Articles_gh":
-                    return "公众号投流";
-                default:
-                    return "";
-            }
-        }
-        return "";
-    }
-
-    private String getChannelType(String s) {
-        String key = String.format("%s:%s", channelGroupPrefix, s);
-        String value = redisTemplate.opsForValue().get(key);
-        if (null != value && value.equals("公众号买号")) {
-            return value;
-        }
-        return "公众号代运营-Daily";
-    }
-}

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

@@ -35,6 +35,7 @@ public final class ScorerUtils {
         ScorerUtils.init("feeds_score_config_20240807.conf");
         ScorerUtils.init("feeds_score_config_fm_xgb_20250303.conf");
         ScorerUtils.init("feeds_score_config_fm_xgb_20250317.conf");
+        ScorerUtils.init("feeds_score_config_fm_xgb_20250423.conf");
         ScorerUtils.init("feeds_score_config_xgb_str_20250228.conf");
         ScorerUtils.init("feeds_score_config_xgb_ros_20250311.conf");
         ScorerUtils.init("feeds_score_config_xgb_ros_binary_20250319.conf");

+ 3 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/score/VlogShareLRScorer.java

@@ -174,6 +174,9 @@ public class VlogShareLRScorer extends BaseLRModelScorer {
                     if (!future.isDone() || future.isCancelled() || future.get() == null) {
                         cancel++;
                     }
+                    if (!future.isDone() && !future.isCancelled()) {
+                        future.cancel(true);
+                    }
                 } catch (InterruptedException e) {
                     LOGGER.error("InterruptedException {},{}", ExceptionUtils.getFullStackTrace(e));
                 } catch (ExecutionException e) {

+ 3 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/score/VlogShareLRScorer4Ros.java

@@ -174,6 +174,9 @@ public class VlogShareLRScorer4Ros extends BaseLRModelScorer {
                     if (!future.isDone() || future.isCancelled() || future.get() == null) {
                         cancel++;
                     }
+                    if (!future.isDone() && !future.isCancelled()) {
+                        future.cancel(true);
+                    }
                 } catch (InterruptedException e) {
                     LOGGER.error("InterruptedException {},{}", ExceptionUtils.getFullStackTrace(e));
                 } catch (ExecutionException e) {

+ 22 - 72
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/util/FeatureUtils.java

@@ -1,5 +1,7 @@
 package com.tzld.piaoquan.recommend.server.util;
 
+import org.apache.commons.lang3.StringUtils;
+
 import java.util.HashMap;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -10,84 +12,26 @@ public class FeatureUtils {
     public static final String cate2Attr = "cate2";
     public static final String festive1Attr = "festive_label1";
     public static final String channelAttr = "channel";
-    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 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 String channelRegex = "(longArticles_|dyyjs_|touliu_tencent_|touliu_tencentgzh_|touliu_tencentGzhArticle_|GzhTouLiu_Articles_gh)";
-    private static final String channelRegex = "(dyyjs_|touliu_tencent_)";
     private static final Pattern goodMorningPattern = Pattern.compile(goodMorningRegex);
     private static final Pattern goodAfternoonPattern = Pattern.compile(goodAfternoonRegex);
     private static final Pattern goodEveningPattern = Pattern.compile(goodEveningRegex);
-    private static final Pattern channelPattern = Pattern.compile(channelRegex);
+    private static final Map<String, String[]> userChannelPrefixMap = new HashMap<>();
 
     static {
-        cate1MAP.put("情感", 1);
-        cate1MAP.put("音乐", 2);
-        cate1MAP.put("搞笑", 3);
-        cate1MAP.put("生活记录", 4);
-        cate1MAP.put("医疗健康", 5);
-        cate1MAP.put("文化", 6);
-        cate1MAP.put("旅行", 7);
-        cate1MAP.put("美食", 8);
-        cate1MAP.put("历史", 9);
-        cate1MAP.put("科普", 10);
-        cate1MAP.put("艺术", 11);
-        cate1MAP.put("综艺", 12);
-        cate1MAP.put("时政", 13);
-        cate1MAP.put("三农", 14);
-        cate1MAP.put("舞蹈", 15);
-
-        cate2MAP.put("人生忠告", 1);
-        cate2MAP.put("知识科普", 2);
-        cate2MAP.put("祝福音乐", 3);
-        cate2MAP.put("生活小妙招", 4);
-        cate2MAP.put("节日祝福", 5);
-        cate2MAP.put("搞笑段子", 6);
-        cate2MAP.put("怀念时光", 7);
-        cate2MAP.put("早中晚好", 8);
-        cate2MAP.put("风景实拍", 9);
-        cate2MAP.put("动物萌宠", 10);
-        cate2MAP.put("美食教程", 11);
-        cate2MAP.put("国家力量", 12);
-        cate2MAP.put("中国历史影像", 13);
-        cate2MAP.put("杂技柔术", 14);
-        cate2MAP.put("健康知识", 15);
-        cate2MAP.put("传统文化", 16);
-        cate2MAP.put("长寿知识", 17);
-        cate2MAP.put("社会风气", 18);
-        cate2MAP.put("大型集体艺术", 19);
-        cate2MAP.put("省份城市亮点", 20);
-        cate2MAP.put("民生政策", 21);
-        cate2MAP.put("健身操", 22);
-        cate2MAP.put("亲情音乐", 23);
-        cate2MAP.put("天气变化", 24);
-        cate2MAP.put("人财诈骗", 25);
-        cate2MAP.put("正能量剧情", 26);
-
-        festive1Map.put("节假日", 1);
-        festive1Map.put("问候语", 2);
-        festive1Map.put("祝福语", 3);
-        festive1Map.put("节气", 4);
-        festive1Map.put("热点", 5);
-        festive1Map.put("人物", 6);
-    }
-
-    public static int getAttrId(String cate, String value) {
-        switch (cate) {
-            case cate1Attr:
-                return cate1MAP.getOrDefault(value, 0);
-            case cate2Attr:
-                return cate2MAP.getOrDefault(value, 0);
-            case festive1Attr:
-                return festive1Map.getOrDefault(value, 0);
-            default:
-                return 0;
-        }
+        // 公众号买号 & 公众号代运营-Daily, 需要二次判断
+        userChannelPrefixMap.put("公众号mix", new String[]{"longArticles_"});
+        userChannelPrefixMap.put("公众号代运营-即转", new String[]{"dyyjs_"});
+        userChannelPrefixMap.put("小程序投流", new String[]{"touliu_tencent_"});
+        userChannelPrefixMap.put("公众号投流", new String[]{"touliu_tencentgzh_", "touliu_tencentGzhArticle_", "GzhTouLiu_Articles_gh"});
+        userChannelPrefixMap.put("测-企微投放", new String[]{"touliu_tencentqw_", "WeCom_"});
+        userChannelPrefixMap.put("测-企微合作", new String[]{"touliu_tencentwbqw_", "dyyqw_"});
+        userChannelPrefixMap.put("停-公众号合作", new String[]{"gzhhz_"});
+        userChannelPrefixMap.put("测-公众号完全代投放", new String[]{"daitou_tencentgzh", "DaiTou_gh"});
     }
 
     public static int judgeVideoTimeType(String s) {
@@ -162,10 +106,16 @@ public class FeatureUtils {
         return null != userShareDepth && 0 == userShareDepth;
     }
 
-    public static Matcher getChannelMatcher(String s) {
-        if (null != s && !s.isEmpty()) {
-            return channelPattern.matcher(s);
+    public static String getUserChannel(String rootSourceId) {
+        if (null != rootSourceId && !rootSourceId.isEmpty()) {
+            for (Map.Entry<String, String[]> entry : userChannelPrefixMap.entrySet()) {
+                String channel = entry.getKey();
+                String[] prefixArray = entry.getValue();
+                if (StringUtils.startsWithAny(rootSourceId, prefixArray)) {
+                    return channel;
+                }
+            }
         }
-        return null;
+        return "";
     }
 }

+ 467 - 0
recommend-server-service/src/main/resources/feeds_score_config_fm_xgb_20250423.conf

@@ -0,0 +1,467 @@
+scorer-config = {
+  rov-score-config = {
+     scorer-name = "com.tzld.piaoquan.recommend.server.service.score.VlogRovFMScorer"
+     scorer-priority = 96
+     model-path = "zhangbo/model_fm_for_recsys_v7_rov.txt"
+  }
+  nor-score-config = {
+    scorer-name = "com.tzld.piaoquan.recommend.server.service.score.NorXGBRegressionScorer"
+    scorer-priority = 97
+    model-path = "zhangbo/model_xgb_for_recsys_v6_nor.tar.gz"
+    param = {
+      localDir = "xgboost/recsys_v6_nor"
+      features = [
+      "b0_12h@exp",
+      "b0_12h@is_return_1",
+      "b0_12h@is_share",
+      "b0_12h@return_1_uv",
+      "b0_12h@return_n_uv",
+      "b0_12h@ros",
+      "b0_12h@ros1",
+      "b0_12h@ros_minus",
+      "b0_12h@ros_minus1",
+      "b0_12h@ros_n",
+      "b0_12h@ros_n1",
+      "b0_12h@ros_one",
+      "b0_12h@rovn",
+      "b0_12h@rovn1",
+      "b0_12h@share_cnt",
+      "b0_12h@str",
+      "b0_12h@str_plus",
+      "b0_1h@exp",
+      "b0_1h@is_return_1",
+      "b0_1h@is_share",
+      "b0_1h@return_1_uv",
+      "b0_1h@return_n_uv",
+      "b0_1h@ros",
+      "b0_1h@ros1",
+      "b0_1h@ros_minus",
+      "b0_1h@ros_minus1",
+      "b0_1h@ros_n",
+      "b0_1h@ros_n1",
+      "b0_1h@ros_one",
+      "b0_1h@rovn",
+      "b0_1h@rovn1",
+      "b0_1h@share_cnt",
+      "b0_1h@str",
+      "b0_1h@str_plus",
+      "b0_3h@exp",
+      "b0_3h@is_return_1",
+      "b0_3h@is_share",
+      "b0_3h@return_1_uv",
+      "b0_3h@return_n_uv",
+      "b0_3h@ros",
+      "b0_3h@ros1",
+      "b0_3h@ros_minus",
+      "b0_3h@ros_minus1",
+      "b0_3h@ros_n",
+      "b0_3h@ros_n1",
+      "b0_3h@ros_one",
+      "b0_3h@rovn",
+      "b0_3h@rovn1",
+      "b0_3h@share_cnt",
+      "b0_3h@str",
+      "b0_3h@str_plus",
+      "b0_6h@exp",
+      "b0_6h@is_return_1",
+      "b0_6h@is_share",
+      "b0_6h@return_1_uv",
+      "b0_6h@return_n_uv",
+      "b0_6h@ros",
+      "b0_6h@ros1",
+      "b0_6h@ros_minus",
+      "b0_6h@ros_minus1",
+      "b0_6h@ros_n",
+      "b0_6h@ros_n1",
+      "b0_6h@ros_one",
+      "b0_6h@rovn",
+      "b0_6h@rovn1",
+      "b0_6h@share_cnt",
+      "b0_6h@str",
+      "b0_6h@str_plus",
+      "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",
+      "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@m_r_uv",
+      "c9@m_s_cnt",
+      "c9@r_pv",
+      "c9@r_uv",
+      "c9@ros",
+      "c9@ros_minus",
+      "c9@ros_one",
+      "c9@s_cnt",
+      "c9@s_pv",
+      "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@title",
+      "c9_lrs@1@ts",
+      "c9_lrs@1@uv",
+      "c9_lrs@2@title",
+      "c9_lrs@2@ts",
+      "c9_lrs@2@uv",
+      "c9_lss@1@cnt",
+      "c9_lss@1@title",
+      "c9_lss@1@ts",
+      "c9_lss@2@cnt",
+      "c9_lss@2@title",
+      "c9_lss@2@ts",
+      "c9_mrs@1@title",
+      "c9_mrs@1@ts",
+      "c9_mrs@1@uv",
+      "c9_mrs@2@title",
+      "c9_mrs@2@ts",
+      "c9_mrs@2@uv",
+      "c9_mss@1@cnt",
+      "c9_mss@1@title",
+      "c9_mss@1@ts",
+      "c9_mss@2@cnt",
+      "c9_mss@2@title",
+      "c9_mss@2@ts",
+      "d1@ros_cf_rank",
+      "d1@ros_cf_score",
+      "d1@rov_cf_rank",
+      "d1@rov_cf_score",
+      "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@cate2",
+      "hr_sim@cate2_list",
+      "hr_sim@keywords",
+      "hr_sim@title",
+      "r@bit_rate",
+      "r@total_time",
+      "r@ts",
+      "r@tt@1"
+      ]
+    }
+  }
+}