|  | @@ -13,6 +13,7 @@ import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
 | 
											
												
													
														|  |  import lombok.extern.slf4j.Slf4j;
 |  |  import lombok.extern.slf4j.Slf4j;
 | 
											
												
													
														|  |  import org.apache.commons.collections4.MapUtils;
 |  |  import org.apache.commons.collections4.MapUtils;
 | 
											
												
													
														|  |  import org.apache.commons.lang3.StringUtils;
 |  |  import org.apache.commons.lang3.StringUtils;
 | 
											
												
													
														|  | 
 |  | +import org.apache.hadoop.util.StopWatch;
 | 
											
												
													
														|  |  import org.springframework.beans.factory.annotation.Autowired;
 |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.xm.Similarity;
 |  |  import org.xm.Similarity;
 | 
											
										
											
												
													
														|  | @@ -72,7 +73,8 @@ public class RankService687 extends RankStrategyXGBBasic {
 | 
											
												
													
														|  |          Map<String, String> e2Feature = userFeature.getOrDefault("alg_mid_feature_share_tags", new HashMap<>());
 |  |          Map<String, String> e2Feature = userFeature.getOrDefault("alg_mid_feature_share_tags", new HashMap<>());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
 |  |          Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
 | 
											
												
													
														|  | -        long time1 = sw.stop().elapsed(TimeUnit.MILLISECONDS);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        long time1 = sw.elapsed(TimeUnit.MILLISECONDS);
 | 
											
												
													
														|  | 
 |  | +        sw.reset();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          List<AdRankItem> adRankItems = new ArrayList<>(request.getAdIdList().size());
 |  |          List<AdRankItem> adRankItems = new ArrayList<>(request.getAdIdList().size());
 | 
											
												
													
														|  |          for (AdPlatformCreativeDTO dto : request.getAdIdList()) {
 |  |          for (AdPlatformCreativeDTO dto : request.getAdIdList()) {
 | 
											
										
											
												
													
														|  | @@ -118,7 +120,8 @@ public class RankService687 extends RankStrategyXGBBasic {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        long time2 = sw.stop().elapsed(TimeUnit.MILLISECONDS);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        long time2 = sw.elapsed(TimeUnit.MILLISECONDS);
 | 
											
												
													
														|  | 
 |  | +        sw.reset();
 | 
											
												
													
														|  |          // 分桶
 |  |          // 分桶
 | 
											
												
													
														|  |          this.readBucketFile();
 |  |          this.readBucketFile();
 | 
											
												
													
														|  |          userFeatureMap = this.featureBucket(userFeatureMap);
 |  |          userFeatureMap = this.featureBucket(userFeatureMap);
 | 
											
										
											
												
													
														|  | @@ -133,7 +136,8 @@ public class RankService687 extends RankStrategyXGBBasic {
 | 
											
												
													
														|  |          List<AdRankItem> result = ScorerUtils.getScorerPipeline(ScorerUtils.XGBOOST_SCORE_CONF_683)
 |  |          List<AdRankItem> result = ScorerUtils.getScorerPipeline(ScorerUtils.XGBOOST_SCORE_CONF_683)
 | 
											
												
													
														|  |                  .scoring(sceneFeatureMap, userFeatureMap, adRankItems);
 |  |                  .scoring(sceneFeatureMap, userFeatureMap, adRankItems);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        long time3 = sw.stop().elapsed(TimeUnit.MILLISECONDS);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        long time3 = sw.elapsed(TimeUnit.MILLISECONDS);
 | 
											
												
													
														|  | 
 |  | +        sw.reset();
 | 
											
												
													
														|  |          for (AdRankItem item : result) {
 |  |          for (AdRankItem item : result) {
 | 
											
												
													
														|  |              item.setScore(item.getLrScore() * item.getCpa());
 |  |              item.setScore(item.getLrScore() * item.getCpa());
 | 
											
												
													
														|  |              item.getScoreMap().put("cpa", item.getCpa());
 |  |              item.getScoreMap().put("cpa", item.getCpa());
 | 
											
										
											
												
													
														|  | @@ -173,7 +177,8 @@ public class RankService687 extends RankStrategyXGBBasic {
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        long time4 = sw.stop().elapsed(TimeUnit.MILLISECONDS);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        long time4 = sw.elapsed(TimeUnit.MILLISECONDS);
 | 
											
												
													
														|  | 
 |  | +        sw.reset();
 | 
											
												
													
														|  |          log.info("cost={}, feature1={}, feature2={}, getScorerPipeline={}, loop={}",
 |  |          log.info("cost={}, feature1={}, feature2={}, getScorerPipeline={}, loop={}",
 | 
											
												
													
														|  |                  System.currentTimeMillis() - start, time1, time2, time3, time4);
 |  |                  System.currentTimeMillis() - start, time1, time2, time3, time4);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -550,5 +555,4 @@ public class RankService687 extends RankStrategyXGBBasic {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          return newFeatureMap;
 |  |          return newFeatureMap;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  }
 |  |  }
 |