Ver Fonte

83 sample 特征分割符

jch há 1 mês atrás
pai
commit
a5a9dc5c1f

+ 62 - 62
src/main/scala/com/aliyun/odps/spark/examples/myUtils/FeatureTransformV2.java

@@ -67,15 +67,15 @@ public class FeatureTransformV2 {
                 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);
+                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);
             }
         }
         if (null != userInfo && !userInfo.isEmpty()) {
@@ -103,9 +103,9 @@ public class FeatureTransformV2 {
             String tags = infoMap.getOrDefault(period, "");
             if (!tags.isEmpty()) {
                 Double[] doubles = FeatureUtils.funcC34567ForTagsNew(tags, title);
-                featMap.put(prefix + "_" + period + "_matchnum", doubles[0]);
-                featMap.put(prefix + "_" + period + "_maxscore", doubles[1]);
-                featMap.put(prefix + "_" + period + "_avgscore", doubles[2]);
+                featMap.put(prefix + "_" + period + "@matchnum", doubles[0]);
+                featMap.put(prefix + "_" + period + "@maxscore", doubles[1]);
+                featMap.put(prefix + "_" + period + "@avgscore", doubles[2]);
             }
         }
     }
@@ -122,9 +122,9 @@ public class FeatureTransformV2 {
                     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);
+                    featMap.put(prefix + "_" + cfType + "@score", score1);
+                    featMap.put(prefix + "_" + cfType + "@num", score2);
+                    featMap.put(prefix + "_" + cfType + "@rank", score3);
                 }
             }
         }
@@ -312,7 +312,7 @@ public class FeatureTransformV2 {
             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);
+                featMap.put(prefix + "@" + attr, simScore);
             }
         }
     }
@@ -322,28 +322,28 @@ public class FeatureTransformV2 {
         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);
+        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);
+        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 = FeatureUtils.plusSmooth(return_n, exp, smoothPlus);
-        featMap.put(prefix + "_exp", FeatureUtils.log1(exp, log1Scale));
-        featMap.put(prefix + "_return_n", FeatureUtils.log1(return_n, log1Scale));
-        featMap.put(prefix + "_rovn", rovn);
+        featMap.put(prefix + "@exp", FeatureUtils.log1(exp, log1Scale));
+        featMap.put(prefix + "@return_n", FeatureUtils.log1(return_n, log1Scale));
+        featMap.put(prefix + "@rovn", rovn);
     }
 
     public static Map<String, Map<String, String[]>> parseUCFScore(Map<String, String> mapInfo) {
@@ -385,13 +385,13 @@ public class FeatureTransformV2 {
             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);
+            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);
         }
     }
 
@@ -424,18 +424,18 @@ public class FeatureTransformV2 {
             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);
+            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);
         }
     }
 
@@ -475,23 +475,23 @@ public class FeatureTransformV2 {
             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_1_uv", return_1_uv_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 + "_" + "rovn1", rovn1);
-            featMap.put(prefix + "_" + period + "_" + "ros1", ros1);
-            featMap.put(prefix + "_" + period + "_" + "ros_n1", ros_n1);
-            featMap.put(prefix + "_" + period + "_" + "ros_minus1", ros_minus1);
-            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);
+            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_1_uv", return_1_uv_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 + "@" + "rovn1", rovn1);
+            featMap.put(prefix + "_" + period + "@" + "ros1", ros1);
+            featMap.put(prefix + "_" + period + "@" + "ros_n1", ros_n1);
+            featMap.put(prefix + "_" + period + "@" + "ros_minus1", ros_minus1);
+            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);
         }
     }