|
@@ -96,6 +96,7 @@ public class RankExtractorItemFeature {
|
|
|
if (maps.containsKey(key)){
|
|
|
Map<String, Double> fList = maps.get(key);
|
|
|
List<Double> arrs = hourStrs.stream().map(r -> fList.getOrDefault(r, 0.0D)).collect(Collectors.toList());
|
|
|
+ Collections.reverse(arrs);
|
|
|
result1.put(key+"_"+N+"_avg", ExtractorUtils.calculateAverage(arrs));
|
|
|
result1.put(key+"_"+N+"_var", ExtractorUtils.calculateVariance(arrs));
|
|
|
|
|
@@ -108,6 +109,7 @@ public class RankExtractorItemFeature {
|
|
|
if (maps.containsKey(key)){
|
|
|
Map<String, Double> fList = maps.get(key);
|
|
|
List<Double> arrs = hourStrs.stream().map(r -> fList.getOrDefault(r, 0.0D)).collect(Collectors.toList());
|
|
|
+ Collections.reverse(arrs);
|
|
|
result1.put(key+"_"+N+"_avg", ExtractorUtils.calculateAverage(arrs));
|
|
|
result1.put(key+"_"+N+"_var", ExtractorUtils.calculateVariance(arrs));
|
|
|
|
|
@@ -120,6 +122,7 @@ public class RankExtractorItemFeature {
|
|
|
if (maps.containsKey(key)){
|
|
|
Map<String, Double> fList = maps.get(key);
|
|
|
List<Double> arrs = hourStrs.stream().map(r -> fList.getOrDefault(r, 0.0D)).collect(Collectors.toList());
|
|
|
+ Collections.reverse(arrs);
|
|
|
result1.put(key+"_"+N+"_avg", ExtractorUtils.calculateAverage(arrs));
|
|
|
result1.put(key+"_"+N+"_var", ExtractorUtils.calculateVariance(arrs));
|
|
|
|
|
@@ -132,6 +135,7 @@ public class RankExtractorItemFeature {
|
|
|
if (maps.containsKey(key)){
|
|
|
Map<String, Double> fList = maps.get(key);
|
|
|
List<Double> arrs = hourStrs.stream().map(r -> fList.getOrDefault(r, 0.0D)).collect(Collectors.toList());
|
|
|
+ Collections.reverse(arrs);
|
|
|
result1.put(key+"_"+N+"_avg", ExtractorUtils.calculateAverage(arrs));
|
|
|
result1.put(key+"_"+N+"_var", ExtractorUtils.calculateVariance(arrs));
|
|
|
|
|
@@ -300,4 +304,21 @@ public class RankExtractorItemFeature {
|
|
|
|
|
|
return rateFeatureChange(result);
|
|
|
}
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String s1 = "share_uv_list_1day";
|
|
|
+ String s2 = "2024011300:2,2024011301:2,2024011304:2,2024011309:3,2024011311:3,2024011314:4,2024011315:4,2024011321:1,2024011323:1,2024011400:1,2024011401:1,2024011404:1,2024011406:1,2024011407:1,2024011408:1,2024011410:1,2024011423:1,2024011302:2,2024011305:2,2024011312:4,2024011313:4,2024011317:4,2024011318:4,2024011319:3,2024011320:1,2024011403:1,2024011409:1,2024011411:1,2024011419:1,2024011420:1,2024011422:1,2024011303:2,2024011306:2,2024011307:2,2024011308:2,2024011310:3,2024011316:4,2024011322:1,2024011402:1,2024011405:1,2024011421:1";
|
|
|
+ Map<String, Double> m1 = new HashMap<>();
|
|
|
+ Map<String, Map<String, Double>> maps = new HashMap<>();
|
|
|
+ for (String s : s2.split(",")){
|
|
|
+ String s3 = s.split(":")[0];
|
|
|
+ String s4 = s.split(":")[1];
|
|
|
+ m1.put(s3, Double.valueOf(s4));
|
|
|
+ }
|
|
|
+ maps.put(s1, m1);
|
|
|
+
|
|
|
+ String date = "20240114";
|
|
|
+ String hour = "20";
|
|
|
+ System.out.println(getItemRealtimeTrend(maps, date, hour));
|
|
|
+ }
|
|
|
}
|