|
@@ -13,6 +13,7 @@ public class FeatureV6 {
|
|
private static final int seqMaxN = 2;
|
|
private static final int seqMaxN = 2;
|
|
private static final int seqLastN = 2;
|
|
private static final int seqLastN = 2;
|
|
private static final double smoothPlus = 5.0;
|
|
private static final double smoothPlus = 5.0;
|
|
|
|
+ private static final double largerSmoothPlus = 30.0;
|
|
private static final double log1Scale = 10.0;
|
|
private static final double log1Scale = 10.0;
|
|
private static final List<String> c1Periods = Arrays.asList("72h", "168h");
|
|
private static final List<String> c1Periods = Arrays.asList("72h", "168h");
|
|
private static final List<String> b0Periods = Arrays.asList("1h", "3h", "6h", "12h");
|
|
private static final List<String> b0Periods = Arrays.asList("1h", "3h", "6h", "12h");
|
|
@@ -28,11 +29,12 @@ public class FeatureV6 {
|
|
private static final List<String> b10Periods = Arrays.asList("1h", "12h");
|
|
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> b11Periods = Arrays.asList("12h", "168h");
|
|
private static final List<String> b13Periods = Arrays.asList("24h", "168h");
|
|
private static final List<String> b13Periods = Arrays.asList("24h", "168h");
|
|
- private static final List<String> videoCateAttrs = Arrays.asList(FeatureUtils.cate1Attr, FeatureUtils.cate2Attr, FeatureUtils.festive1Attr, FeatureUtils.channelAttr);
|
|
|
|
|
|
+ private static final List<String> videoCateAttrs = Arrays.asList(FeatureUtils.cate1Attr, FeatureUtils.cate2Attr, FeatureUtils.festive1Attr, FeatureUtils.channelAttr, FeatureUtils.sourceAttr);
|
|
private static final List<String> videoSimAttrs = Arrays.asList("title", "cate2", "cate2_list", "keywords");
|
|
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> hVideoSimAttrs = Arrays.asList("title");
|
|
private static final List<String> cfList = Arrays.asList("share", "return");
|
|
private static final List<String> cfList = Arrays.asList("share", "return");
|
|
private static final List<String> userAttrList = Arrays.asList("province", "city", "model", "brand", "system", "user_channel", "user_level");
|
|
private static final List<String> userAttrList = Arrays.asList("province", "city", "model", "brand", "system", "user_channel", "user_level");
|
|
|
|
+ private static final Set<String> appSet = new HashSet<>(Arrays.asList("0", "2", "4"));
|
|
private static final Set<String> hotSceneSet = new HashSet<>(Arrays.asList("1008", "1007", "1058", "1074", "1010"));
|
|
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) {
|
|
public static void getContextFeature(long currentMs, String appType, String hotSceneType, Map<String, Double> featureMap) {
|
|
@@ -44,7 +46,13 @@ public class FeatureV6 {
|
|
featureMap.put(String.format("%s@%d", "week", week), 1.0);
|
|
featureMap.put(String.format("%s@%d", "week", week), 1.0);
|
|
featureMap.put(String.format("%s@%d", "hour", hour), 1.0);
|
|
featureMap.put(String.format("%s@%d", "hour", hour), 1.0);
|
|
featureMap.put("hour", hour * 1.0);
|
|
featureMap.put("hour", hour * 1.0);
|
|
- featureMap.put(String.format("%s@%s", "app", appType), 1.0);
|
|
|
|
|
|
+ String app;
|
|
|
|
+ if (appSet.contains(appType)) {
|
|
|
|
+ app = appType;
|
|
|
|
+ } else {
|
|
|
|
+ app = "other";
|
|
|
|
+ }
|
|
|
|
+ featureMap.put(String.format("%s@%s", "app", app), 1.0);
|
|
String hot;
|
|
String hot;
|
|
if (hotSceneSet.contains(hotSceneType)) {
|
|
if (hotSceneSet.contains(hotSceneType)) {
|
|
hot = hotSceneType;
|
|
hot = hotSceneType;
|
|
@@ -302,7 +310,7 @@ public class FeatureV6 {
|
|
if (videoInfo.containsKey("keywords")) {
|
|
if (videoInfo.containsKey("keywords")) {
|
|
String keywords = videoInfo.get("keywords");
|
|
String keywords = videoInfo.get("keywords");
|
|
if (null != keywords && !keywords.isEmpty()) {
|
|
if (null != keywords && !keywords.isEmpty()) {
|
|
- for (String kw : keywords.split(",")) {
|
|
|
|
|
|
+ for (String kw : keywords.split("[,,、]")) {
|
|
kw = kw.replaceAll("(\\s+|\\t|:)", "");
|
|
kw = kw.replaceAll("(\\s+|\\t|:)", "");
|
|
if (!kw.isEmpty()) {
|
|
if (!kw.isEmpty()) {
|
|
String featKey = String.format("%s@kw@%s", prefix, kw);
|
|
String featKey = String.format("%s@kw@%s", prefix, kw);
|
|
@@ -409,6 +417,12 @@ public class FeatureV6 {
|
|
double ros_n = FeatureUtils.plusSmooth(return_n_uv, share_cnt, smoothPlus);
|
|
double ros_n = FeatureUtils.plusSmooth(return_n_uv, share_cnt, smoothPlus);
|
|
double ros_minus = FeatureUtils.plusSmooth(return_n_uv, is_return_1, smoothPlus);
|
|
double ros_minus = FeatureUtils.plusSmooth(return_n_uv, is_return_1, smoothPlus);
|
|
|
|
|
|
|
|
+ // larger smooth
|
|
|
|
+ double l_rovn = FeatureUtils.plusSmooth(return_n_uv, exp, largerSmoothPlus, 1);
|
|
|
|
+ double l_ros = FeatureUtils.plusSmooth(return_n_uv / 5, is_share, largerSmoothPlus, 2);
|
|
|
|
+ double l_ros_n = FeatureUtils.plusSmooth(return_n_uv / 5, share_cnt, largerSmoothPlus, 2);
|
|
|
|
+ double l_ros_minus = FeatureUtils.plusSmooth(return_n_uv / 5, is_return_1, largerSmoothPlus, 2);
|
|
|
|
+
|
|
featMap.put(prefix + "_" + period + "@" + "exp", exp_s);
|
|
featMap.put(prefix + "_" + period + "@" + "exp", exp_s);
|
|
featMap.put(prefix + "_" + period + "@" + "is_share", is_share_s);
|
|
featMap.put(prefix + "_" + period + "@" + "is_share", is_share_s);
|
|
featMap.put(prefix + "_" + period + "@" + "share_cnt", share_cnt_s);
|
|
featMap.put(prefix + "_" + period + "@" + "share_cnt", share_cnt_s);
|
|
@@ -421,6 +435,12 @@ public class FeatureV6 {
|
|
featMap.put(prefix + "_" + period + "@" + "ros", ros);
|
|
featMap.put(prefix + "_" + period + "@" + "ros", ros);
|
|
featMap.put(prefix + "_" + period + "@" + "ros_n", ros_n);
|
|
featMap.put(prefix + "_" + period + "@" + "ros_n", ros_n);
|
|
featMap.put(prefix + "_" + period + "@" + "ros_minus", ros_minus);
|
|
featMap.put(prefix + "_" + period + "@" + "ros_minus", ros_minus);
|
|
|
|
+
|
|
|
|
+ // larger smooth
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "rovn_#", l_rovn);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros_#", l_ros);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros_n_#", l_ros_n);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros_minus_#", l_ros_minus);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -460,6 +480,17 @@ public class FeatureV6 {
|
|
double ros_n = FeatureUtils.plusSmooth(return_n_uv, share_cnt, smoothPlus);
|
|
double ros_n = FeatureUtils.plusSmooth(return_n_uv, share_cnt, smoothPlus);
|
|
double ros_minus = FeatureUtils.plusSmooth(return_n_uv, is_return_1, smoothPlus);
|
|
double ros_minus = FeatureUtils.plusSmooth(return_n_uv, is_return_1, smoothPlus);
|
|
|
|
|
|
|
|
+ // larger smooth
|
|
|
|
+ double l_rovn1 = FeatureUtils.plusSmooth(return_1_uv, exp, largerSmoothPlus, 1);
|
|
|
|
+ double l_ros1 = FeatureUtils.plusSmooth(return_1_uv / 5, is_share, largerSmoothPlus, 2);
|
|
|
|
+ double l_ros_n1 = FeatureUtils.plusSmooth(return_1_uv / 5, share_cnt, largerSmoothPlus, 2);
|
|
|
|
+ double l_ros_minus1 = FeatureUtils.plusSmooth(return_1_uv / 5, is_return_1, largerSmoothPlus, 2);
|
|
|
|
+
|
|
|
|
+ double l_rovn = FeatureUtils.plusSmooth(return_n_uv, exp, largerSmoothPlus, 1);
|
|
|
|
+ double l_ros = FeatureUtils.plusSmooth(return_n_uv / 5, is_share, largerSmoothPlus, 2);
|
|
|
|
+ double l_ros_n = FeatureUtils.plusSmooth(return_n_uv / 5, share_cnt, largerSmoothPlus, 2);
|
|
|
|
+ double l_ros_minus = FeatureUtils.plusSmooth(return_n_uv / 5, is_return_1, largerSmoothPlus, 2);
|
|
|
|
+
|
|
featMap.put(prefix + "_" + period + "@" + "exp", exp_s);
|
|
featMap.put(prefix + "_" + period + "@" + "exp", exp_s);
|
|
featMap.put(prefix + "_" + period + "@" + "is_share", is_share_s);
|
|
featMap.put(prefix + "_" + period + "@" + "is_share", is_share_s);
|
|
featMap.put(prefix + "_" + period + "@" + "share_cnt", share_cnt_s);
|
|
featMap.put(prefix + "_" + period + "@" + "share_cnt", share_cnt_s);
|
|
@@ -477,6 +508,16 @@ public class FeatureV6 {
|
|
featMap.put(prefix + "_" + period + "@" + "ros", ros);
|
|
featMap.put(prefix + "_" + period + "@" + "ros", ros);
|
|
featMap.put(prefix + "_" + period + "@" + "ros_n", ros_n);
|
|
featMap.put(prefix + "_" + period + "@" + "ros_n", ros_n);
|
|
featMap.put(prefix + "_" + period + "@" + "ros_minus", ros_minus);
|
|
featMap.put(prefix + "_" + period + "@" + "ros_minus", ros_minus);
|
|
|
|
+
|
|
|
|
+ // larger smooth
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "rovn1_#", l_rovn1);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros1_#", l_ros1);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros_n1_#", l_ros_n1);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros_minus1_#", l_ros_minus1);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "rovn_#", l_rovn);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros_#", l_ros);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros_n_#", l_ros_n);
|
|
|
|
+ featMap.put(prefix + "_" + period + "@" + "ros_minus_#", l_ros_minus);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|