|
@@ -5,6 +5,8 @@ import examples.utils.SimilarityUtils;
|
|
|
import java.util.*;
|
|
|
|
|
|
public class FeatureTransform {
|
|
|
+ private static final int seqMaxN = 2;
|
|
|
+ private static final int seqLastN = 2;
|
|
|
private static final double smoothPlus = 5.0;
|
|
|
private static final List<String> hourPeriods = Arrays.asList("1h", "3h", "6h", "12h", "24h", "72h", "168h");
|
|
|
private static final List<String> dayPeriods = Arrays.asList("7d", "14d", "30d", "60d");
|
|
@@ -50,15 +52,15 @@ public class FeatureTransform {
|
|
|
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("up@s_pv", s_pv_s);
|
|
|
- featMap.put("up@s_cnt", s_cnt_s);
|
|
|
- featMap.put("up@r_pv", r_pv_s);
|
|
|
- featMap.put("up@r_uv", r_uv_s);
|
|
|
- featMap.put("up@m_s_cnt", m_s_cnt_s);
|
|
|
- featMap.put("up@m_r_uv", m_r_uv_s);
|
|
|
- featMap.put("up@ros_one", ros_one);
|
|
|
- featMap.put("up@ros", ros);
|
|
|
- featMap.put("up@ros_minus", ros_minus);
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -153,20 +155,18 @@ public class FeatureTransform {
|
|
|
if (null == profile) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- int maxN = 2;
|
|
|
- getRSCrossFeature("mss", currentMs, maxN, profile.getM_s_s(), rankVideo, hVideoMap, featMap);
|
|
|
- getRSCrossFeature("mrs", currentMs, maxN, profile.getM_r_s(), rankVideo, hVideoMap, featMap);
|
|
|
- getRSCrossFeature("lss", currentMs, maxN, profile.getL_s_s(), rankVideo, hVideoMap, featMap);
|
|
|
- getRSCrossFeature("lrs", currentMs, maxN, profile.getL_r_s(), rankVideo, hVideoMap, featMap);
|
|
|
+ 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("c1s", rankVideo.getOrDefault("merge_first_level_cate", ""), profile.getC1_s(), featMap);
|
|
|
- getVideoAttrSRCrossFeature("c2s", rankVideo.getOrDefault("merge_second_level_cate", ""), profile.getC2_s(), featMap);
|
|
|
- getVideoAttrSRCrossFeature("l1s", rankVideo.getOrDefault("festive_label1", ""), profile.getL1_s(), featMap);
|
|
|
- getVideoAttrSRCrossFeature("l2s", rankVideo.getOrDefault("festive_label2", ""), profile.getL2_s(), featMap);
|
|
|
+ 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) {
|