|
@@ -8,9 +8,7 @@ import com.tzld.piaoquan.recommend.server.service.rank.RankParam;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.RankResult;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.RankResult;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.RankService;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.RankService;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.extractor.ExtractorUtils;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.extractor.ExtractorUtils;
|
|
-import com.tzld.piaoquan.recommend.server.service.rank.extractor.RankExtractorItemFeature;
|
|
|
|
import com.tzld.piaoquan.recommend.server.service.rank.extractor.RankExtractorItemTags;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.extractor.RankExtractorItemTags;
|
|
-import com.tzld.piaoquan.recommend.server.service.rank.extractor.RankExtractorUserFeature;
|
|
|
|
import com.tzld.piaoquan.recommend.server.service.rank.processor.RankProcessorBoost;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.processor.RankProcessorBoost;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.processor.RankProcessorDensity;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.processor.RankProcessorDensity;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.processor.RankProcessorInsert;
|
|
import com.tzld.piaoquan.recommend.server.service.rank.processor.RankProcessorInsert;
|
|
@@ -21,9 +19,6 @@ import com.tzld.piaoquan.recommend.server.util.JSONUtils;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
-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.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
@@ -37,19 +32,12 @@ import java.util.stream.Collectors;
|
|
@Service
|
|
@Service
|
|
@Slf4j
|
|
@Slf4j
|
|
public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
- @ApolloJsonValue("${rank.score.merge.weight:ShareDeepAndWidth:}")
|
|
|
|
|
|
+ @ApolloJsonValue("${rank.score.merge.weightv645:}")
|
|
private Map<String, Double> mergeWeight;
|
|
private Map<String, Double> mergeWeight;
|
|
@ApolloJsonValue("${RankStrategy4DensityFilterV2:}")
|
|
@ApolloJsonValue("${RankStrategy4DensityFilterV2:}")
|
|
private final Map<String, Map<String, Map<String, String>>> filterRules = new HashMap<>();
|
|
private final Map<String, Map<String, Map<String, String>>> filterRules = new HashMap<>();
|
|
final private String CLASS_NAME = this.getClass().getSimpleName();
|
|
final private String CLASS_NAME = this.getClass().getSimpleName();
|
|
|
|
|
|
- @Autowired
|
|
|
|
- @Qualifier("featureRedisTemplate")
|
|
|
|
- private RedisTemplate<String, String> featureRedisTemplate;
|
|
|
|
-
|
|
|
|
- public RankStrategy4ShareDeepAndWidth() {
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public void duplicate(Set<Long> setVideo, List<Video> videos) {
|
|
public void duplicate(Set<Long> setVideo, List<Video> videos) {
|
|
Iterator<Video> iterator = videos.iterator();
|
|
Iterator<Video> iterator = videos.iterator();
|
|
while (iterator.hasNext()) {
|
|
while (iterator.hasNext()) {
|
|
@@ -65,27 +53,49 @@ public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
@Override
|
|
@Override
|
|
public List<Video> mergeAndRankRovRecall(RankParam param) {
|
|
public List<Video> mergeAndRankRovRecall(RankParam param) {
|
|
Map<String, Double> mergeWeight = this.mergeWeight != null ? this.mergeWeight : new HashMap<>(0);
|
|
Map<String, Double> mergeWeight = this.mergeWeight != null ? this.mergeWeight : new HashMap<>(0);
|
|
- //-------------------相关性召回 融合+去重-------------------
|
|
|
|
|
|
+ //-------------------融-------------------
|
|
|
|
+ //-------------------合-------------------
|
|
|
|
+ //-------------------逻-------------------
|
|
|
|
+ //-------------------辑-------------------
|
|
|
|
+
|
|
|
|
+ List<Video> oldRovs = new ArrayList<>();
|
|
|
|
+ oldRovs.addAll(extractAndSort(param, RegionHRecallStrategy.PUSH_FORM));
|
|
|
|
+ oldRovs.addAll(extractAndSort(param, RegionHDupRecallStrategy.PUSH_FORM));
|
|
|
|
+ oldRovs.addAll(extractAndSort(param, Region24HRecallStrategy.PUSH_FORM));
|
|
|
|
+ oldRovs.addAll(extractAndSort(param, RegionRelative24HRecallStrategy.PUSH_FORM));
|
|
|
|
+ oldRovs.addAll(extractAndSort(param, RegionRelative24HDupRecallStrategy.PUSH_FORM));
|
|
|
|
+ removeDuplicate(oldRovs);
|
|
|
|
+ int sizeReturn = param.getSize();
|
|
|
|
+ List<Video> v0 = oldRovs.size() <= sizeReturn
|
|
|
|
+ ? oldRovs
|
|
|
|
+ : oldRovs.subList(0, sizeReturn);
|
|
Set<Long> setVideo = new HashSet<>();
|
|
Set<Long> setVideo = new HashSet<>();
|
|
- List<Video> v1 = extractAndSort(param, SimHotVideoRecallStrategy.PUSH_FORM);
|
|
|
|
- List<Video> v2 = extractAndSort(param, ReturnVideoRecallStrategy.PUSH_FORM);
|
|
|
|
- this.duplicate(setVideo, v1);
|
|
|
|
- this.duplicate(setVideo, v2);
|
|
|
|
- //-------------------流量池直接送 融合+去重-------------------
|
|
|
|
- List<Video> v3 = extractAndSort(param, FlowPoolLastDayTopRecallStrategy.PUSH_FORM);
|
|
|
|
- this.duplicate(setVideo, v3);
|
|
|
|
- //-------------------分享深度召回 融合+去重-------------------
|
|
|
|
- List<Video> v4 = extractAndSort(param, ShareDeepRecallStrategy.PUSH_FORM);
|
|
|
|
- this.duplicate(setVideo, v4);
|
|
|
|
- //-------------------分享广度召回 融合+去重-------------------
|
|
|
|
- List<Video> v5 = extractAndSort(param, ShareWidthRecallStrategy.PUSH_FORM);
|
|
|
|
|
|
+ this.duplicate(setVideo, v0);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //-------------------相关性召回 融合+去重-------------------
|
|
|
|
+ List<Video> v5 = extractAndSort(param, SimHotVideoRecallStrategy.PUSH_FORM);
|
|
|
|
+ List<Video> v6 = extractAndSort(param, ReturnVideoRecallStrategy.PUSH_FORM);
|
|
this.duplicate(setVideo, v5);
|
|
this.duplicate(setVideo, v5);
|
|
|
|
+ this.duplicate(setVideo, v6);
|
|
|
|
+ //-------------------分享深度、广度 融合+去重-------------------
|
|
|
|
+ List<Video> v9 = extractAndSort(param, ShareWidthRecallStrategy.PUSH_FORM);
|
|
|
|
+ List<Video> v10 = extractAndSort(param, ShareDeepRecallStrategy.PUSH_FORM);
|
|
|
|
+ this.duplicate(setVideo, v9);
|
|
|
|
+ //-------------------地域相关召回 融合+去重-------------------
|
|
|
|
+ List<Video> v1 = extractAndSort(param, RegionRealtimeRecallStrategyV1.PUSH_FORM);
|
|
|
|
+ this.duplicate(setVideo, v1);
|
|
|
|
+ //-------------------节日扶持召回 融合+去重-------------------
|
|
|
|
+ List<Video> v7 = extractAndSort(param, FestivalRecallStrategyV1.PUSH_FORM);
|
|
|
|
+ this.duplicate(setVideo, v7);
|
|
List<Video> rovRecallRank = new ArrayList<>();
|
|
List<Video> rovRecallRank = new ArrayList<>();
|
|
- rovRecallRank.addAll(v1.subList(0, Math.min(mergeWeight.getOrDefault("v1", 5.0).intValue(), v1.size())));
|
|
|
|
- rovRecallRank.addAll(v2.subList(0, Math.min(mergeWeight.getOrDefault("v2", 5.0).intValue(), v2.size())));
|
|
|
|
- rovRecallRank.addAll(v3.subList(0, Math.min(mergeWeight.getOrDefault("v3", 5.0).intValue(), v3.size())));
|
|
|
|
- rovRecallRank.addAll(v4.subList(0, Math.min(mergeWeight.getOrDefault("v4", 5.0).intValue(), v4.size())));
|
|
|
|
|
|
+ rovRecallRank.addAll(v0);
|
|
rovRecallRank.addAll(v5.subList(0, Math.min(mergeWeight.getOrDefault("v5", 5.0).intValue(), v5.size())));
|
|
rovRecallRank.addAll(v5.subList(0, Math.min(mergeWeight.getOrDefault("v5", 5.0).intValue(), v5.size())));
|
|
|
|
+ rovRecallRank.addAll(v6.subList(0, Math.min(mergeWeight.getOrDefault("v6", 5.0).intValue(), v6.size())));
|
|
|
|
+ rovRecallRank.addAll(v9.subList(0, Math.min(mergeWeight.getOrDefault("v9", 5.0).intValue(), v9.size())));
|
|
|
|
+ rovRecallRank.addAll(v10.subList(0, Math.min(mergeWeight.getOrDefault("v10", 5.0).intValue(), v10.size())));
|
|
|
|
+ rovRecallRank.addAll(v1.subList(0, Math.min(mergeWeight.getOrDefault("v1", 5.0).intValue(), v1.size())));
|
|
|
|
+ rovRecallRank.addAll(v7.subList(0, Math.min(mergeWeight.getOrDefault("v7", 5.0).intValue(), v7.size())));
|
|
|
|
|
|
//-------------------排-------------------
|
|
//-------------------排-------------------
|
|
//-------------------序-------------------
|
|
//-------------------序-------------------
|
|
@@ -148,14 +158,20 @@ public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
double share2allreturnScore = item.scoresMap.getOrDefault("share2allreturnScore", 0.0);
|
|
double share2allreturnScore = item.scoresMap.getOrDefault("share2allreturnScore", 0.0);
|
|
double view2allreturnScore = item.scoresMap.getOrDefault("view2allreturnScore", 0.0);
|
|
double view2allreturnScore = item.scoresMap.getOrDefault("view2allreturnScore", 0.0);
|
|
double score = 0.0;
|
|
double score = 0.0;
|
|
- double allShareCount = item.scoresMap.getOrDefault("sumShareCount", 0.0);
|
|
|
|
- double daySharedepthMaxAvg = Double.parseDouble(featureMap.getOrDefault("i_1day_sharedepth_max_avg", "0.0"));
|
|
|
|
- double daySharewidthMaxAvg = Double.parseDouble(featureMap.getOrDefault("i_1day_sharewidth_max_avg", "0.0"));
|
|
|
|
- if (allShareCount > 50) {
|
|
|
|
- score += a * daySharedepthMaxAvg + b * daySharewidthMaxAvg * 0.05;
|
|
|
|
|
|
+ double allreturnsScore = item.scoresMap.getOrDefault("allreturnsScore", 0.0);
|
|
|
|
+ if (allreturnsScore > 50) {
|
|
|
|
+ score += (f * share2allreturnScore + g * view2allreturnScore);
|
|
} else {
|
|
} else {
|
|
score += (f * share2allreturnScore + g * view2allreturnScore) * 0.01;
|
|
score += (f * share2allreturnScore + g * view2allreturnScore) * 0.01;
|
|
}
|
|
}
|
|
|
|
+ double sumShareCount = item.scoresMap.getOrDefault("sumShareCount", 0.0);
|
|
|
|
+ double daySharedepthMaxAvg = Double.parseDouble(featureMap.getOrDefault("i_1day_sharedepth_max_avg", "0.0"));
|
|
|
|
+ double daySharewidthMaxAvg = Double.parseDouble(featureMap.getOrDefault("i_1day_sharewidth_max_avg", "0.0"));
|
|
|
|
+
|
|
|
|
+ if (sumShareCount > 30) {
|
|
|
|
+ score += a * daySharedepthMaxAvg + b * daySharewidthMaxAvg;
|
|
|
|
+ }
|
|
|
|
+
|
|
Video video = item.getVideo();
|
|
Video video = item.getVideo();
|
|
video.setScore(score);
|
|
video.setScore(score);
|
|
video.setSortScore(score);
|
|
video.setSortScore(score);
|
|
@@ -210,98 +226,9 @@ public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- // 0: 场景特征处理
|
|
|
|
- Map<String, String> sceneFeatureMap = this.getSceneFeature(param);
|
|
|
|
-
|
|
|
|
- // 1: user特征处理
|
|
|
|
- Map<String, String> userFeatureMap = new HashMap<>();
|
|
|
|
- if (param.getMid() != null && !param.getMid().isEmpty()) {
|
|
|
|
- String midKey = "user_info_4video_" + param.getMid();
|
|
|
|
- String userFeatureStr = featureRedisTemplate.opsForValue().get(midKey);
|
|
|
|
- if (userFeatureStr != null) {
|
|
|
|
- try {
|
|
|
|
- userFeatureMap = JSONUtils.fromJson(userFeatureStr,
|
|
|
|
- new TypeToken<Map<String, String>>() {
|
|
|
|
- },
|
|
|
|
- userFeatureMap);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error(String.format("parse user json is wrong in {} with {}", this.CLASS_NAME, e));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- final Set<String> userFeatureSet = new HashSet<>(Arrays.asList(
|
|
|
|
- "machineinfo_brand", "machineinfo_model", "machineinfo_platform", "machineinfo_system",
|
|
|
|
- "u_1day_exp_cnt", "u_1day_click_cnt", "u_1day_share_cnt", "u_1day_return_cnt",
|
|
|
|
- "u_3day_exp_cnt", "u_3day_click_cnt", "u_3day_share_cnt", "u_3day_return_cnt"
|
|
|
|
- ));
|
|
|
|
- Iterator<Map.Entry<String, String>> iterator = userFeatureMap.entrySet().iterator();
|
|
|
|
- while (iterator.hasNext()) {
|
|
|
|
- Map.Entry<String, String> entry = iterator.next();
|
|
|
|
- if (!userFeatureSet.contains(entry.getKey())) {
|
|
|
|
- iterator.remove();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Map<String, String> f1 = RankExtractorUserFeature.getOriginFeature(userFeatureMap,
|
|
|
|
- new HashSet<String>(Arrays.asList(
|
|
|
|
- "machineinfo_brand", "machineinfo_model", "machineinfo_platform", "machineinfo_system"
|
|
|
|
- ))
|
|
|
|
- );
|
|
|
|
- Map<String, String> f2 = RankExtractorUserFeature.getUserRateFeature(userFeatureMap);
|
|
|
|
- Map<String, String> f3 = RankExtractorUserFeature.cntFeatureChange(userFeatureMap,
|
|
|
|
- new HashSet<String>(Arrays.asList(
|
|
|
|
- "u_1day_exp_cnt", "u_1day_click_cnt", "u_1day_share_cnt", "u_1day_return_cnt",
|
|
|
|
- "u_3day_exp_cnt", "u_3day_click_cnt", "u_3day_share_cnt", "u_3day_return_cnt"
|
|
|
|
- ))
|
|
|
|
- );
|
|
|
|
- f1.putAll(f2);
|
|
|
|
- f1.putAll(f3);
|
|
|
|
-
|
|
|
|
- // 2-1: item特征处理
|
|
|
|
- final Set<String> itemFeatureSet = new HashSet<>(Arrays.asList(
|
|
|
|
- "total_time", "play_count_total",
|
|
|
|
- "i_1day_exp_cnt", "i_1day_click_cnt", "i_1day_share_cnt", "i_1day_return_cnt",
|
|
|
|
- "i_3day_exp_cnt", "i_3day_click_cnt", "i_3day_share_cnt", "i_3day_return_cnt"
|
|
|
|
- ));
|
|
|
|
-
|
|
|
|
List<RankItem> rankItems = CommonCollectionUtils.toList(videos, RankItem::new);
|
|
List<RankItem> rankItems = CommonCollectionUtils.toList(videos, RankItem::new);
|
|
List<Long> videoIds = CommonCollectionUtils.toListDistinct(videos, Video::getVideoId);
|
|
List<Long> videoIds = CommonCollectionUtils.toListDistinct(videos, Video::getVideoId);
|
|
- List<String> videoFeatureKeys = videoIds.stream().map(r -> "video_info_" + r)
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
- List<String> videoFeatures = featureRedisTemplate.opsForValue().multiGet(videoFeatureKeys);
|
|
|
|
- if (videoFeatures != null) {
|
|
|
|
- for (int i = 0; i < videoFeatures.size(); ++i) {
|
|
|
|
- String vF = videoFeatures.get(i);
|
|
|
|
- Map<String, String> vfMap = new HashMap<>();
|
|
|
|
- if (vF == null) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- vfMap = JSONUtils.fromJson(vF, new TypeToken<Map<String, String>>() {
|
|
|
|
- }, vfMap);
|
|
|
|
- Map<String, String> vfMapCopy = new HashMap<>(vfMap);
|
|
|
|
- rankItems.get(i).setItemBasicFeature(vfMapCopy);
|
|
|
|
- Iterator<Map.Entry<String, String>> iteratorIn = vfMap.entrySet().iterator();
|
|
|
|
- while (iteratorIn.hasNext()) {
|
|
|
|
- Map.Entry<String, String> entry = iteratorIn.next();
|
|
|
|
- if (!itemFeatureSet.contains(entry.getKey())) {
|
|
|
|
- iteratorIn.remove();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- Map<String, String> f4 = RankExtractorItemFeature.getItemRateFeature(vfMap);
|
|
|
|
- Map<String, String> f5 = RankExtractorItemFeature.cntFeatureChange(vfMap,
|
|
|
|
- new HashSet<String>(Arrays.asList(
|
|
|
|
- "total_time", "play_count_total",
|
|
|
|
- "i_1day_exp_cnt", "i_1day_click_cnt", "i_1day_share_cnt", "i_1day_return_cnt",
|
|
|
|
- "i_3day_exp_cnt", "i_3day_click_cnt", "i_3day_share_cnt", "i_3day_return_cnt"))
|
|
|
|
- );
|
|
|
|
- f4.putAll(f5);
|
|
|
|
- rankItems.get(i).setFeatureMap(f4);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error(String.format("parse video json is wrong in {} with {}", this.CLASS_NAME, e));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
// 2-2: item 实时特征处理
|
|
// 2-2: item 实时特征处理
|
|
List<String> rtFeaPartKey = new ArrayList<>(Arrays.asList("item_rt_fea_1day_partition", "item_rt_fea_1h_partition"));
|
|
List<String> rtFeaPartKey = new ArrayList<>(Arrays.asList("item_rt_fea_1day_partition", "item_rt_fea_1h_partition"));
|
|
List<String> rtFeaPartKeyResult = this.redisTemplate.opsForValue().multiGet(rtFeaPartKey);
|
|
List<String> rtFeaPartKeyResult = this.redisTemplate.opsForValue().multiGet(rtFeaPartKey);
|
|
@@ -309,14 +236,10 @@ public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
String date = new SimpleDateFormat("yyyyMMdd").format(calendar.getTime());
|
|
String date = new SimpleDateFormat("yyyyMMdd").format(calendar.getTime());
|
|
String hour = new SimpleDateFormat("HH").format(calendar.getTime());
|
|
String hour = new SimpleDateFormat("HH").format(calendar.getTime());
|
|
String rtFeaPart1day = date + hour;
|
|
String rtFeaPart1day = date + hour;
|
|
- String rtFeaPart1h = date + hour;
|
|
|
|
if (rtFeaPartKeyResult != null) {
|
|
if (rtFeaPartKeyResult != null) {
|
|
if (rtFeaPartKeyResult.get(0) != null) {
|
|
if (rtFeaPartKeyResult.get(0) != null) {
|
|
rtFeaPart1day = rtFeaPartKeyResult.get(0);
|
|
rtFeaPart1day = rtFeaPartKeyResult.get(0);
|
|
}
|
|
}
|
|
- if (rtFeaPartKeyResult.get(1) != null) {
|
|
|
|
- rtFeaPart1h = rtFeaPartKeyResult.get(1);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
List<String> videoRtKeys1 = videoIds.stream().map(r -> "item_rt_fea_1day_" + r)
|
|
List<String> videoRtKeys1 = videoIds.stream().map(r -> "item_rt_fea_1day_" + r)
|
|
@@ -356,9 +279,6 @@ public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(String.format("parse video item_rt_fea_1day_ json is wrong in {} with {}", this.CLASS_NAME, e));
|
|
log.error(String.format("parse video item_rt_fea_1day_ json is wrong in {} with {}", this.CLASS_NAME, e));
|
|
}
|
|
}
|
|
- Map<String, String> f8 = RankExtractorItemFeature.getItemRealtimeRate(vfMapNew, rtFeaPart1day);
|
|
|
|
- item.getFeatureMap().putAll(f8);
|
|
|
|
-
|
|
|
|
|
|
|
|
String k1 = "sharedepth_max_avg_list_1day";
|
|
String k1 = "sharedepth_max_avg_list_1day";
|
|
String k2 = "sharewidth_max_avg_list_1day";
|
|
String k2 = "sharewidth_max_avg_list_1day";
|
|
@@ -401,44 +321,12 @@ public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(String.format("parse video item_rt_fea_1h_ json is wrong in {} with {}", this.CLASS_NAME, e));
|
|
log.error(String.format("parse video item_rt_fea_1h_ json is wrong in {} with {}", this.CLASS_NAME, e));
|
|
}
|
|
}
|
|
- Map<String, String> f8 = RankExtractorItemFeature.getItemRealtimeRate(vfMapNew, rtFeaPart1h);
|
|
|
|
- item.getFeatureMap().putAll(f8);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
return rankItems;
|
|
return rankItems;
|
|
}
|
|
}
|
|
|
|
|
|
- private Map<String, String> getSceneFeature(RankParam param) {
|
|
|
|
- Map<String, String> sceneFeatureMap = new HashMap<>();
|
|
|
|
- String provinceCn = param.getProvince();
|
|
|
|
- provinceCn = provinceCn.replaceAll("省$", "");
|
|
|
|
- sceneFeatureMap.put("ctx_region", provinceCn);
|
|
|
|
- String city = param.getCity();
|
|
|
|
- if ("台北市".equals(city) |
|
|
|
|
- "高雄市".equals(city) |
|
|
|
|
- "台中市".equals(city) |
|
|
|
|
- "桃园市".equals(city) |
|
|
|
|
- "新北市".equals(city) |
|
|
|
|
- "台南市".equals(city) |
|
|
|
|
- "基隆市".equals(city) |
|
|
|
|
- "吉林市".equals(city) |
|
|
|
|
- "新竹市".equals(city) |
|
|
|
|
- "嘉义市".equals(city)
|
|
|
|
- ) {
|
|
|
|
- } else {
|
|
|
|
- city = city.replaceAll("市$", "");
|
|
|
|
- }
|
|
|
|
- sceneFeatureMap.put("ctx_city", city);
|
|
|
|
-
|
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
|
- sceneFeatureMap.put("ctx_week", (calendar.get(Calendar.DAY_OF_WEEK) + 6) % 7 + "");
|
|
|
|
- sceneFeatureMap.put("ctx_hour", new SimpleDateFormat("HH").format(calendar.getTime()));
|
|
|
|
-
|
|
|
|
- return sceneFeatureMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public RankResult mergeAndSort(RankParam param, List<Video> rovVideos, List<Video> flowVideos) {
|
|
public RankResult mergeAndSort(RankParam param, List<Video> rovVideos, List<Video> flowVideos) {
|
|
|
|
|
|
@@ -535,7 +423,7 @@ public class RankStrategy4ShareDeepAndWidth extends RankService {
|
|
String up2 = "2024031012:409,2024031013:464,2024031014:354,2024031015:474,2024031016:436,2024031017:636,2024031018:709,2024031019:741,2024031020:802,2024031021:904,2024031022:1112,2024031023:639,2024031100:378,2024031101:78,2024031102:47,2024031103:37,2024031104:17,2024031105:49,2024031106:103,2024031107:293,2024031108:457,2024031109:488,2024031110:558,2024031111:711,2024031112:785,2024031113:830,2024031114:974,2024031115:850";
|
|
String up2 = "2024031012:409,2024031013:464,2024031014:354,2024031015:474,2024031016:436,2024031017:636,2024031018:709,2024031019:741,2024031020:802,2024031021:904,2024031022:1112,2024031023:639,2024031100:378,2024031101:78,2024031102:47,2024031103:37,2024031104:17,2024031105:49,2024031106:103,2024031107:293,2024031108:457,2024031109:488,2024031110:558,2024031111:711,2024031112:785,2024031113:830,2024031114:974,2024031115:850";
|
|
String down2 = "2024031012:748,2024031013:886,2024031014:788,2024031015:1029,2024031016:957,2024031017:1170,2024031018:1208,2024031019:1181,2024031020:1275,2024031021:1265,2024031022:1512,2024031023:1190,2024031100:1127,2024031101:486,2024031102:289,2024031103:254,2024031104:197,2024031105:310,2024031106:344,2024031107:693,2024031108:976,2024031109:1045,2024031110:1039,2024031111:1257,2024031112:1202,2024031113:1454,2024031114:1785,2024031115:1544";
|
|
String down2 = "2024031012:748,2024031013:886,2024031014:788,2024031015:1029,2024031016:957,2024031017:1170,2024031018:1208,2024031019:1181,2024031020:1275,2024031021:1265,2024031022:1512,2024031023:1190,2024031100:1127,2024031101:486,2024031102:289,2024031103:254,2024031104:197,2024031105:310,2024031106:344,2024031107:693,2024031108:976,2024031109:1045,2024031110:1039,2024031111:1257,2024031112:1202,2024031113:1454,2024031114:1785,2024031115:1544";
|
|
|
|
|
|
- RankStrategy4ShareDeepAndWidth job = new RankStrategy4ShareDeepAndWidth();
|
|
|
|
|
|
+ RankStrategy4RegionMergeModelV567 job = new RankStrategy4RegionMergeModelV567();
|
|
List<Double> l1 = job.getRateData(job.help(up1, "2024031115", 24), job.help(down1, "2024031115", 24), 1., 10.);
|
|
List<Double> l1 = job.getRateData(job.help(up1, "2024031115", 24), job.help(down1, "2024031115", 24), 1., 10.);
|
|
Double d1 = job.calScoreWeightNoTimeDecay(l1);
|
|
Double d1 = job.calScoreWeightNoTimeDecay(l1);
|
|
|
|
|