|
@@ -35,8 +35,6 @@ import static com.tzld.piaoquan.recommend.server.service.flowpool.FlowPoolConsta
|
|
@Service
|
|
@Service
|
|
@Slf4j
|
|
@Slf4j
|
|
public class FlowPoolWithLevelRecallStrategyTomson extends AbstractFlowPoolWithLevelRecallStrategy {
|
|
public class FlowPoolWithLevelRecallStrategyTomson extends AbstractFlowPoolWithLevelRecallStrategy {
|
|
- @ApolloJsonValue("${ifOneLevelRandom:true}")
|
|
|
|
- private boolean ifOneLevelRandom;
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private FlowPoolConfigService flowPoolConfigService;
|
|
private FlowPoolConfigService flowPoolConfigService;
|
|
|
|
|
|
@@ -135,27 +133,16 @@ public class FlowPoolWithLevelRecallStrategyTomson extends AbstractFlowPoolWithL
|
|
videoFlowPoolMap_.put(NumberUtils.toLong(values[0], 0), values[1]);
|
|
videoFlowPoolMap_.put(NumberUtils.toLong(values[0], 0), values[1]);
|
|
}
|
|
}
|
|
Map<Long, Double> resultmap = null;
|
|
Map<Long, Double> resultmap = null;
|
|
- if ("1".equals(level) && ifOneLevelRandom) {
|
|
+ ScorerPipeline4Recall pipeline = ScorerUtils.getScorerPipeline4Recall("feeds_recall_config_tomson.conf");
|
|
-
|
|
+ List<List<Pair<Long, Double>>> results = pipeline.recall(videoFlowPoolMap);
|
|
- int limitSize = 60;
|
|
+ List<Pair<Long, Double>> result = results.get(0);
|
|
- List<Long> keyList = new ArrayList<>(videoFlowPoolMap_.keySet());
|
|
+ resultmap = result.stream()
|
|
- Collections.shuffle(keyList);
|
|
+ .collect(Collectors.toMap(
|
|
- resultmap = keyList.stream().limit(limitSize).collect(Collectors.toMap(
|
|
+ Pair::getLeft,
|
|
- key -> key,
|
|
+ Pair::getRight,
|
|
- key -> Math.random()
|
|
+ (existingValue, newValue) -> existingValue,
|
|
- ));
|
|
+ LinkedHashMap::new
|
|
- } else {
|
|
+ ));
|
|
- ScorerPipeline4Recall pipeline = ScorerUtils.getScorerPipeline4Recall("feeds_recall_config_tomson.conf");
|
|
|
|
- List<List<Pair<Long, Double>>> results = pipeline.recall(videoFlowPoolMap);
|
|
|
|
- List<Pair<Long, Double>> result = results.get(0);
|
|
|
|
- resultmap = result.stream()
|
|
|
|
- .collect(Collectors.toMap(
|
|
|
|
- Pair::getLeft,
|
|
|
|
- Pair::getRight,
|
|
|
|
- (existingValue, newValue) -> existingValue,
|
|
|
|
- LinkedHashMap::new
|
|
|
|
- ));
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
FilterParam filterParam = FilterParamFactory.create(param, new ArrayList<>(resultmap.keySet()));
|
|
FilterParam filterParam = FilterParamFactory.create(param, new ArrayList<>(resultmap.keySet()));
|