|
@@ -16,6 +16,7 @@ import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
|
|
|
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.collections4.MapUtils;
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
|
|
+import org.apache.commons.lang.math.NumberUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -52,9 +53,8 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
@Value("${word2vec.exp:694}")
|
|
@Value("${word2vec.exp:694}")
|
|
|
private String word2vecExp;
|
|
private String word2vecExp;
|
|
|
|
|
|
|
|
- @Value("${view.833.limit:3000}")
|
|
|
|
|
- private Integer viewLimit;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ @ApolloJsonValue("${rank.score.params.833:{}}")
|
|
|
|
|
+ private Map<String, String> paramsMap;
|
|
|
|
|
|
|
|
// FIXME(zhoutian): 可能需要独立配置
|
|
// FIXME(zhoutian): 可能需要独立配置
|
|
|
@ApolloJsonValue("${rank.score.weight.680:{}}")
|
|
@ApolloJsonValue("${rank.score.weight.680:{}}")
|
|
@@ -304,6 +304,7 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
log.error("scoring result is empty");
|
|
log.error("scoring result is empty");
|
|
|
}
|
|
}
|
|
|
long time5 = System.currentTimeMillis();
|
|
long time5 = System.currentTimeMillis();
|
|
|
|
|
+ int viewLimit = NumberUtils.toInt(paramsMap.getOrDefault("viewLimit", "3000"));
|
|
|
// calibrate score for negative sampling or cold start
|
|
// calibrate score for negative sampling or cold start
|
|
|
for (AdRankItem item : result) {
|
|
for (AdRankItem item : result) {
|
|
|
double originalScore = item.getLrScore();
|
|
double originalScore = item.getLrScore();
|
|
@@ -319,7 +320,7 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
double smoothCxr = NumUtil.divSmoothV1(conver, view, 1.64);
|
|
double smoothCxr = NumUtil.divSmoothV1(conver, view, 1.64);
|
|
|
//模型打分和统计计算取打分更低的
|
|
//模型打分和统计计算取打分更低的
|
|
|
item.getScoreMap().put("cvcvrItemValue", 1.0);
|
|
item.getScoreMap().put("cvcvrItemValue", 1.0);
|
|
|
- if(smoothCxr <= calibratedScore){
|
|
|
|
|
|
|
+ if (smoothCxr <= calibratedScore) {
|
|
|
calibratedScore = smoothCxr;
|
|
calibratedScore = smoothCxr;
|
|
|
item.getScoreMap().put("cvcvrItemValue", 2.0);
|
|
item.getScoreMap().put("cvcvrItemValue", 2.0);
|
|
|
}
|
|
}
|
|
@@ -330,7 +331,8 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
item.getScoreMap().put("ctcvrScore", calibratedScore);
|
|
item.getScoreMap().put("ctcvrScore", calibratedScore);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- calculateCtcvrScore(result, request, scoreParam, "dnnV2", reqFeature);
|
|
|
|
|
|
|
+ String calibModelName = paramsMap.getOrDefault("calibModelName", "dnnV3");
|
|
|
|
|
+ calculateCtcvrScore(result, request, scoreParam, calibModelName, reqFeature);
|
|
|
if (CollectionUtils.isEmpty(result)) {
|
|
if (CollectionUtils.isEmpty(result)) {
|
|
|
log.error("calculateCtcvrScore result is empty");
|
|
log.error("calculateCtcvrScore result is empty");
|
|
|
}
|
|
}
|
|
@@ -379,6 +381,7 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
|
|
|
|
|
result.sort(ComparatorUtil.equalsRandomComparator());
|
|
result.sort(ComparatorUtil.equalsRandomComparator());
|
|
|
|
|
|
|
|
|
|
+ String logModelName = paramsMap.getOrDefault("logModelName", "dnnV3");
|
|
|
if (CollectionUtils.isNotEmpty(result)) {
|
|
if (CollectionUtils.isNotEmpty(result)) {
|
|
|
AdRankItem top1Item = result.get(0);
|
|
AdRankItem top1Item = result.get(0);
|
|
|
List<String> participateCompetitionType = new ArrayList<>();
|
|
List<String> participateCompetitionType = new ArrayList<>();
|
|
@@ -397,7 +400,7 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
top1Item.getExt().put("ecpm", modelCtcvrScore * top1Item.getCpa() * 1000);
|
|
top1Item.getExt().put("ecpm", modelCtcvrScore * top1Item.getCpa() * 1000);
|
|
|
}
|
|
}
|
|
|
putMetaFeature(top1Item, feature, reqFeature, sceneFeatureMap, request);
|
|
putMetaFeature(top1Item, feature, reqFeature, sceneFeatureMap, request);
|
|
|
- top1Item.getExt().put("model", "dnnV2");
|
|
|
|
|
|
|
+ top1Item.getExt().put("model", logModelName);
|
|
|
}
|
|
}
|
|
|
long time6 = System.currentTimeMillis();
|
|
long time6 = System.currentTimeMillis();
|
|
|
log.info("cost={}, getFeature={}, handleFeature={}, similar={}, bucketFeature={}, getScorerPipeline={}, " +
|
|
log.info("cost={}, getFeature={}, handleFeature={}, similar={}, bucketFeature={}, getScorerPipeline={}, " +
|