浏览代码

Merge branch 'feature_gufengshou_20240326_threshold_correction'

gufengshou1 1 年之前
父节点
当前提交
40f5257ee9

+ 6 - 8
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/predict/model/threshold/RandomPredictModel.java

@@ -1,21 +1,14 @@
 package com.tzld.piaoquan.ad.engine.service.predict.model.threshold;
 package com.tzld.piaoquan.ad.engine.service.predict.model.threshold;
 
 
+import com.tzld.piaoquan.ad.engine.commons.util.DateUtils;
 import com.tzld.piaoquan.ad.engine.service.predict.container.RandWContainer;
 import com.tzld.piaoquan.ad.engine.service.predict.container.RandWContainer;
 import com.tzld.piaoquan.ad.engine.service.predict.param.ThresholdPredictModelParam;
 import com.tzld.piaoquan.ad.engine.service.predict.param.ThresholdPredictModelParam;
-import com.tzld.piaoquan.ad.engine.service.remote.FeatureRemoteService;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
-import javax.annotation.PostConstruct;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
 
 
 @Component
 @Component
 public class RandomPredictModel extends ThresholdPredictModel {
 public class RandomPredictModel extends ThresholdPredictModel {
@@ -40,6 +33,11 @@ public class RandomPredictModel extends ThresholdPredictModel {
                     modelParam.getExtraParam().getOrDefault("default_threshold","0.5")
                     modelParam.getExtraParam().getOrDefault("default_threshold","0.5")
                     .toString());
                     .toString());
         }
         }
+        double correction=Double.parseDouble(
+                modelParam.getExtraParam()
+                        .getOrDefault("E620_"+modelParam.getAppType()+"_"+DateUtils.getCurrentHour(),1
+                ).toString());
+        threshold=threshold*correction;
         Map<String, Object> result = new HashMap<>();
         Map<String, Object> result = new HashMap<>();
         result.put("ad_predict", score<threshold?2:1);
         result.put("ad_predict", score<threshold?2:1);
         result.put("score", score);
         result.put("score", score);