|
@@ -78,7 +78,7 @@ public class RankService680 {
|
|
|
|
|
|
Map<String, Map<String, String>> adVerFeature = allAdVerFeature.getOrDefault(dto.getAdVerId(), new HashMap<>());
|
|
Map<String, Map<String, String>> adVerFeature = allAdVerFeature.getOrDefault(dto.getAdVerId(), new HashMap<>());
|
|
|
|
|
|
- this.handleB1Feature(b1Feature, cidFeatureMap);
|
|
|
|
|
|
+ this.handleB1Feature(b1Feature, cidFeatureMap, cidStr);
|
|
|
|
|
|
this.handleB2ToB5AndB8Feature(cidFeature, adVerFeature, cidFeatureMap);
|
|
this.handleB2ToB5AndB8Feature(cidFeature, adVerFeature, cidFeatureMap);
|
|
|
|
|
|
@@ -160,7 +160,8 @@ public class RankService680 {
|
|
return featureService.getFeature(cidList, adVerIdList, param);
|
|
return featureService.getFeature(cidList, adVerIdList, param);
|
|
}
|
|
}
|
|
|
|
|
|
- private void handleB1Feature(Map<String, String> b1Feature, Map<String, String> cidFeatureMap) {
|
|
|
|
|
|
+ private void handleB1Feature(Map<String, String> b1Feature, Map<String, String> cidFeatureMap, String cid) {
|
|
|
|
+ cidFeatureMap.put("cid_" + cid, "1");
|
|
if (StringUtils.isNotBlank(b1Feature.get("adid"))) {
|
|
if (StringUtils.isNotBlank(b1Feature.get("adid"))) {
|
|
String adId = b1Feature.get("adid");
|
|
String adId = b1Feature.get("adid");
|
|
cidFeatureMap.put("adid_" + adId, "1");
|
|
cidFeatureMap.put("adid_" + adId, "1");
|
|
@@ -484,11 +485,15 @@ public class RankService680 {
|
|
String name = entry.getKey();
|
|
String name = entry.getKey();
|
|
double score = Double.parseDouble(entry.getValue());
|
|
double score = Double.parseDouble(entry.getValue());
|
|
// 注意:0值、不在分桶文件中的特征,会被过滤掉。
|
|
// 注意:0值、不在分桶文件中的特征,会被过滤掉。
|
|
- if (score > 1E-8 && this.bucketsMap.containsKey(name)) {
|
|
|
|
- double[] buckets = this.bucketsMap.get(name);
|
|
|
|
- int bucketNum = buckets.length + 1;
|
|
|
|
- Double scoreNew = 1.0 / bucketNum * (ExtractorUtils.findInsertPosition(buckets, score) + 1.0);
|
|
|
|
- newFeatureMap.put(name, String.valueOf(scoreNew));
|
|
|
|
|
|
+ if (score > 1E-8) {
|
|
|
|
+ if (this.bucketsMap.containsKey(name)) {
|
|
|
|
+ double[] buckets = this.bucketsMap.get(name);
|
|
|
|
+ int bucketNum = buckets.length + 1;
|
|
|
|
+ Double scoreNew = 1.0 / bucketNum * (ExtractorUtils.findInsertPosition(buckets, score) + 1.0);
|
|
|
|
+ newFeatureMap.put(name, String.valueOf(scoreNew));
|
|
|
|
+ } else {
|
|
|
|
+ newFeatureMap.put(name, String.valueOf(score));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|