Browse Source

Merge branch 'master' into feature_gufengshou_20240125_pid

gufengshou1 1 year ago
parent
commit
bd27083c82

+ 4 - 4
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/predict/model/threshold/ScoreV2ThresholdPredictModel.java

@@ -85,11 +85,11 @@ public class ScoreV2ThresholdPredictModel extends ThresholdPredictModel {
 
         int adPredict;
         if (maxItem != null && maxItem.getScore() < threshold) {
-            // If final score is below threshold, show the ad
-            adPredict = 2;
-        } else {
-            // Otherwise, do not show the ad
+            // If final score is below threshold, do not show the ad
             adPredict = 1;
+        } else {
+            // Otherwise, show the ad
+            adPredict = 2;
         }
         Map<String, Object> result = new HashMap<>();
         result.put("threshold", threshold);

+ 3 - 3
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/VlogMergeBreakScorer.java

@@ -36,9 +36,9 @@ public class VlogMergeBreakScorer extends BaseLRModelScorer {
             double str = item.getStr();
             double ros = item.getRos();
 
-            double a = 0.7;
-            double b = 1;
-            double c = 0.3;
+            double a = 0.2;
+            double b = 1.0;
+            double c = 1.0;
 
             BigDecimal ctrCvr = new BigDecimal(Math.pow(70 * ctr * cvr, a));
             BigDecimal strRos = new BigDecimal(Math.pow(str * ros, b));

+ 15 - 3
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/impl/RankServiceImpl.java

@@ -18,6 +18,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -34,9 +35,12 @@ public class RankServiceImpl implements RankService {
     DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd HH:mm:ss");
     @Autowired
     FeatureRemoteService featureRemoteService;
-
     @Autowired
     RankServiceThompsonImpl rankServiceThompson;
+    @Value("${ad.model.cpm.max:200}")
+    Double cpmMax=200d;
+    @Value("${ad.model.cpm.min:30}")
+    Double cpmMin=30d;
 
     public AdRankItem adItemRank(RankRecommendRequestParam request){
         ScoreParam param= RequestConvert.requestConvert(request);
@@ -161,12 +165,20 @@ public class RankServiceImpl implements RankService {
         result.setPctr(topItem.getCtr());
         result.setPcvr(topItem.getCvr());
         result.setCreativeCode(groupMap.get(topItem.getAdId()+"").get(0).getCreativeCode());
+        double realECpm=0d;
         if(rankResult.size()<=1){
             //经验值 待定
-            result.setEcpm2(topItem.getEcpm1()*0.9);
+            realECpm=topItem.getEcpm1()*0.9;
         }else {
-            result.setEcpm2(rankResult.get(1).getEcpm1());
+            realECpm=rankResult.get(1).getEcpm1();
+        }
+        if(realECpm>cpmMax/1000d){
+            realECpm=cpmMax/1000d;
+        }
+        if(realECpm<cpmMin/1000d){
+            realECpm=cpmMin/1000d;
         }
+        result.setEcpm2(realECpm);
         JSONObject object=new JSONObject();
         object.put("mid",request.getMid());
         object.put("adid",result.getCreativeId());