|
@@ -6,6 +6,7 @@ import com.tzld.piaoquan.ad.engine.commons.redis.AlgorithmRedisHelper;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
|
|
|
import com.tzld.piaoquan.ad.engine.service.score.dto.AdPlatformCreativeDTO;
|
|
|
import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.math3.distribution.BetaDistribution;
|
|
|
import org.slf4j.Logger;
|
|
@@ -253,6 +254,9 @@ public class VideoAdThompsonScorerV2 {
|
|
|
for (AdRankItem adRankItem : result) {
|
|
|
adRankItem.setVideoId(param.getVideoId());
|
|
|
adRankItem.setScore_type(699);
|
|
|
+ if (MapUtils.isNotEmpty(adRankItem.getExt())) {
|
|
|
+ adRankItem.getExt().put("abCode", 699);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return result;
|
|
@@ -269,6 +273,9 @@ public class VideoAdThompsonScorerV2 {
|
|
|
for (AdRankItem adRankItem : result) {
|
|
|
adRankItem.setVideoId(param.getVideoId());
|
|
|
adRankItem.setScore_type(670);
|
|
|
+ if (MapUtils.isNotEmpty(adRankItem.getExt())){
|
|
|
+ adRankItem.getExt().put("abCode", 670);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return result;
|
|
@@ -286,13 +293,29 @@ public class VideoAdThompsonScorerV2 {
|
|
|
double w2 = expParam.getOrDefault("w2", 1d);
|
|
|
double score = ((w1 * vidCidScore + w2 * cidScore) / (w1 + w2)) * dto.getCpa();
|
|
|
|
|
|
- log.info("669 and 670 calcScore cid: {}, score: {}, w1: {}, w2: {}, cidScore: {}, vidCidScore: {}, cidStatistics: {}, vidCidStatistics: {} ",
|
|
|
- dto.getCreativeId(), score, w1, w2, cidScore, vidCidScore, JSON.toJSONString(cidStatistic), JSON.toJSONString(vidCidStatistic));
|
|
|
+
|
|
|
+ // 日志上报扩展参数
|
|
|
+ Map<String, Object> ext = new HashMap<>();
|
|
|
+ ext.put("w1", w1);
|
|
|
+ ext.put("w2", w2);
|
|
|
+ ext.put("cidScore", cidScore);
|
|
|
+ ext.put("vidCidScore", vidCidScore);
|
|
|
+ ext.put("cidA", alpha);
|
|
|
+ ext.put("vidCidA", alpha);
|
|
|
+ ext.put("cidB", cidBeta);
|
|
|
+ ext.put("vidCidB", vidCidBeta);
|
|
|
+ ext.put("cidStatistic", JSON.toJSONString(cidStatistic));
|
|
|
+ ext.put("vidCidStatistic", JSON.toJSONString(vidCidStatistic));
|
|
|
+ ext.put("cpa", dto.getCpa());
|
|
|
+
|
|
|
+ log.info("svc=699And670Score, score: {}, param: {}", score, JSON.toJSONString(expParam));
|
|
|
+
|
|
|
|
|
|
AdRankItem item = new AdRankItem();
|
|
|
item.setCpa(dto.getCpa());
|
|
|
item.setAdId(dto.getCreativeId());
|
|
|
item.setScore(score);
|
|
|
+ item.setExt(ext);
|
|
|
|
|
|
result.add(item);
|
|
|
}
|