Browse Source

Merge branch 'feature_gufengshou_20240401_pid_v6' into pre-master

gufengshou1 1 year ago
parent
commit
5c78a206bb

+ 2 - 2
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/VlogMergeEcpmScorer.java

@@ -78,8 +78,8 @@ public class VlogMergeEcpmScorer extends BaseLRModelScorer {
                 ecpm = cpa * bid1 * bid2 * pcvr * pctr * 1000d;
             }else {
                 cpa=cpa*item.getPidLambda();
-                if(cpa<0.1){
-                    cpa=0.1;
+                if(cpa<0.5){
+                    cpa=0.5;
                 }
                 ecpm = cpa* bid1 * bid2 * pcvr * pctr * 1000d;
             }

+ 22 - 14
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/container/PidLambdaV2Container.java

@@ -99,7 +99,7 @@ public class PidLambdaV2Container {
             Double yesterdayConv=0d;
             Double yesterdayCpa=0d;
             Double yesterdayRealCost=0d;
-            Double latestRealCPA=0d;
+
             while ((line = bufferedReader.readLine()) != null){
                 try {
                     String[] cols=line.split(",");
@@ -123,19 +123,9 @@ public class PidLambdaV2Container {
                             lambdaNew=(yesterdayConv*yesterdayCpa)/yesterdayRealCost;
                         }
                     }
-                    if(conversion!=0){
-                        latestRealCPA=realCost/conversion;
-                        if(cacheItem.latestRealCpa==0d){
-                            cacheItem.latestRealCpa=cpa;
-                        }
-                        if(Math.abs(latestRealCPA-cpa)-Math.abs(cacheItem.latestRealCpa-cpa)>0){
-                            cacheItem.pow=2d;
-                        }else {
-                            cacheItem.pow=1.2;
-                        }
-                        lambdaNew=Math.pow(lambdaNew,cacheItem.pow);
-                        cacheItem.latestRealCpa=latestRealCPA;
-                    }
+
+
+                    lambdaNew=cacheItem.calculate( conversion,  realCost,  cpa,lambdaNew) ;
 
 
                     if(lambdaNew>maxLambda){
@@ -214,6 +204,24 @@ public class PidLambdaV2Container {
             this.creativeId=creativeId;
         }
 
+        public double calculate(double conversion, double realCost, double cpa,double lambdaNew ) {
+            if(conversion!=0){
+                double latestRealCPA=realCost/conversion;
+
+                if(this.latestRealCpa==0d){
+                    this.latestRealCpa=cpa;
+                }
+                if(Math.abs(latestRealCPA-cpa)-Math.abs(this.latestRealCpa-cpa)>0){
+                    this.pow=2d;
+                }else {
+                    this.pow=1.2;
+                }
+                this.latestRealCpa=latestRealCPA;
+                return Math.pow(lambdaNew,this.pow);
+            }
+            return lambdaNew;
+        }
+
         public Long creativeId;
 
         public double lambda=1d;