|
@@ -25,18 +25,15 @@ public class RandomPredictModel extends ThresholdPredictModel {
|
|
|
int hash=modelParam.getMid().hashCode();
|
|
|
hash=hash<0?-hash:hash;
|
|
|
double score=(hash+ RandWContainer.getRandW())%100/100d;
|
|
|
- double threshold=Double.parseDouble(
|
|
|
- modelParam.getExtraParam().getOrDefault(modelParam.getAppType()+"_"+modelParam.getUserExtraFuture("shareType").toString().replace("return","").replace("mids",""),-1
|
|
|
- ).toString());
|
|
|
- if(threshold<0d){
|
|
|
- threshold=Double.parseDouble(
|
|
|
- modelParam.getExtraParam().getOrDefault("default_threshold","0.5")
|
|
|
- .toString());
|
|
|
+
|
|
|
+ String keySuffix = modelParam.getUserExtraFuture("shareType").toString().replace("return", "").replace("mids", "");
|
|
|
+ Integer appType = modelParam.getAppType();
|
|
|
+
|
|
|
+ double threshold = Double.parseDouble(modelParam.getExtraParam().getOrDefault(appType + "_" + keySuffix, -1).toString());
|
|
|
+ if (threshold < 0d) {
|
|
|
+ threshold = Double.parseDouble(modelParam.getExtraParam().getOrDefault("default_" + keySuffix, "-1").toString());
|
|
|
}
|
|
|
- double correction=Double.parseDouble(
|
|
|
- modelParam.getExtraParam()
|
|
|
- .getOrDefault("E620_"+modelParam.getAppType()+"_"+DateUtils.getCurrentHour(),1
|
|
|
- ).toString());
|
|
|
+ double correction = Double.parseDouble(modelParam.getExtraParam().getOrDefault("E620_" + appType + "_" + DateUtils.getCurrentHour(), 1).toString());
|
|
|
threshold=threshold*correction;
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("ad_predict", score<threshold?2:1);
|