|
@@ -12,7 +12,6 @@ import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
-import org.apache.commons.lang.math.NumberUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -96,18 +95,6 @@ public class RankStrategyBy683 extends RankStrategyBasic {
|
|
|
Map<String, String> e1Feature = userFeature.getOrDefault("alg_mid_feature_return_tags", new HashMap<>());
|
|
|
Map<String, String> e2Feature = userFeature.getOrDefault("alg_mid_feature_share_tags", new HashMap<>());
|
|
|
|
|
|
- userFeatureMap.put("brand", request.getMachineInfo().getBrand().toUpperCase());
|
|
|
- userFeatureMap.put("region", request.getRegion());
|
|
|
- userFeatureMap.put("city", request.getCity());
|
|
|
- userFeatureMap.put("vid", String.valueOf(request.getVideoId()));
|
|
|
- userFeatureMap.put("cate1", d3Feature.get("merge_first_level_cate"));
|
|
|
- userFeatureMap.put("cate2", d3Feature.get("merge_second_level_cate"));
|
|
|
- userFeatureMap.put("user_vid_return_tags_2h", e1Feature.getOrDefault("tags_2h", null));
|
|
|
- userFeatureMap.put("user_vid_return_tags_1d", e1Feature.getOrDefault("tags_1d", null));
|
|
|
- userFeatureMap.put("user_vid_return_tags_3d", e1Feature.getOrDefault("tags_3d", null));
|
|
|
- userFeatureMap.put("user_vid_return_tags_7d", e1Feature.getOrDefault("tags_7d", null));
|
|
|
- userFeatureMap.put("user_vid_return_tags_14d", e1Feature.getOrDefault("tags_14d", null));
|
|
|
-
|
|
|
Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
|
|
|
long time1 = System.currentTimeMillis();
|
|
|
|
|
@@ -151,10 +138,6 @@ public class RankStrategyBy683 extends RankStrategyBasic {
|
|
|
this.handleC1UIFeature(midTimeDiffMap, actionStaticMap, cidFeatureMap, cidStr);
|
|
|
this.handleD1Feature(d1Feature, cidFeatureMap);
|
|
|
this.handleD2Feature(vidRankMaps, cidFeatureMap, cidStr);
|
|
|
-
|
|
|
- cidFeatureMap.put("cid", dto.getCreativeId() != null ? String.valueOf(dto.getCreativeId()) : null);
|
|
|
- cidFeatureMap.put("adid", dto.getAdId() != null ? String.valueOf(dto.getAdId()) : null);
|
|
|
- cidFeatureMap.put("adverid", dto.getAdVerId());
|
|
|
return adRankItem;
|
|
|
} finally {
|
|
|
cdl1.countDown();
|
|
@@ -228,7 +211,7 @@ public class RankStrategyBy683 extends RankStrategyBasic {
|
|
|
long time4 = System.currentTimeMillis();
|
|
|
// 打分排序
|
|
|
// getScorerPipeline
|
|
|
- List<AdRankItem> result = ScorerUtils.getScorerPipeline(ScorerUtils.PAI_SCORE_CONF_20250214).scoring(sceneFeatureMap, userFeatureMap, adRankItems);
|
|
|
+ List<AdRankItem> result = ScorerUtils.getScorerPipeline(ScorerUtils.XGBOOST_SCORE_CONF_683).scoring(sceneFeatureMap, userFeatureMap, adRankItems);
|
|
|
long time5 = System.currentTimeMillis();
|
|
|
|
|
|
// calibrate score for negative sampling
|
|
@@ -428,18 +411,7 @@ public class RankStrategyBy683 extends RankStrategyBasic {
|
|
|
featureMap.put("ctcvr_all", String.valueOf(NumUtil.div(converAll, viewAll)));
|
|
|
featureMap.put("cvr_all", String.valueOf(NumUtil.div(clickAll, converAll)));
|
|
|
featureMap.put("ecpm_all", String.valueOf(NumUtil.div(incomeAll * 1000, viewAll)));
|
|
|
- if (CollectionUtils.isEmpty(midActionList)) {
|
|
|
- List<String> cidList = new ArrayList<>();
|
|
|
- List<String> converList = new ArrayList<>();
|
|
|
- for (TupleMapEntry<Tuple5> tupleMapEntry : midActionList) {
|
|
|
- String cid = tupleMapEntry.key;
|
|
|
- String conver = tupleMapEntry.value.f3;
|
|
|
- cidList.add(cid);
|
|
|
- converList.add(conver);
|
|
|
- }
|
|
|
- featureMap.put("user_cid_click_list", String.join(",", cidList));
|
|
|
- featureMap.put("user_cid_conver_list", String.join(",", converList));
|
|
|
- }
|
|
|
+
|
|
|
return midActionList;
|
|
|
}
|
|
|
|
|
@@ -671,31 +643,9 @@ public class RankStrategyBy683 extends RankStrategyBasic {
|
|
|
}
|
|
|
|
|
|
private Map<String, String> featureBucket(Map<String, String> featureMap) {
|
|
|
- Set<String> keys = new HashSet<String>() {{
|
|
|
- add("brand");
|
|
|
- add("region");
|
|
|
- add("city");
|
|
|
- add("vid");
|
|
|
- add("cate1");
|
|
|
- add("cate2");
|
|
|
- add("cid");
|
|
|
- add("adid");
|
|
|
- add("adverid");
|
|
|
- add("user_cid_click_list");
|
|
|
- add("user_cid_conver_list");
|
|
|
- add("user_vid_return_tags_2h");
|
|
|
- add("user_vid_return_tags_1d");
|
|
|
- add("user_vid_return_tags_3d");
|
|
|
- add("user_vid_return_tags_7d");
|
|
|
- add("user_vid_return_tags_14d");
|
|
|
- }};
|
|
|
Map<String, String> newFeatureMap = new ConcurrentHashMap<>(featureMap.size());
|
|
|
for (Map.Entry<String, String> entry : featureMap.entrySet()) {
|
|
|
String name = entry.getKey();
|
|
|
- if (keys.contains(name)) {
|
|
|
- newFeatureMap.put(name, entry.getValue());
|
|
|
- continue;
|
|
|
- }
|
|
|
double score = Double.parseDouble(entry.getValue());
|
|
|
// 注意:0值、不在分桶文件中的特征,会被过滤掉。
|
|
|
if (score > 1E-8) {
|
|
@@ -709,6 +659,7 @@ public class RankStrategyBy683 extends RankStrategyBasic {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return newFeatureMap;
|
|
|
}
|
|
|
|