|
@@ -5,6 +5,8 @@ import com.tzld.piaoquan.recommend.server.model.Video;
|
|
|
import com.tzld.piaoquan.recommend.server.service.flowpool.FlowPoolConstants;
|
|
|
import com.tzld.piaoquan.recommend.server.service.recall.RecallResult;
|
|
|
import com.tzld.piaoquan.recommend.server.service.recall.strategy.*;
|
|
|
+import com.tzld.piaoquan.recommend.server.util.JSONUtils;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
@@ -19,6 +21,7 @@ import java.util.stream.Collectors;
|
|
|
* @author dyp
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class RankService {
|
|
|
@Autowired
|
|
|
private RedisTemplate<String, String> redisTemplate;
|
|
@@ -32,10 +35,16 @@ public class RankService {
|
|
|
}
|
|
|
|
|
|
List<Video> rovRecallRank = mergeAndRankRovRecall(param);
|
|
|
+ log.info("mergeAndRankRovRecall rovRecallRank={}", JSONUtils.toJson(rovRecallRank));
|
|
|
List<Video> flowPoolRank = mergeAndRankFlowPoolRecall(param);
|
|
|
+ log.info("mergeAndRankFlowPoolRecall flowPoolRank={}", JSONUtils.toJson(flowPoolRank));
|
|
|
|
|
|
removeDuplicate(param, rovRecallRank, flowPoolRank);
|
|
|
|
|
|
+ log.info("removeDuplicate rovRecallRank={}, flowPoolRank={}",
|
|
|
+ JSONUtils.toJson(rovRecallRank),
|
|
|
+ JSONUtils.toJson(flowPoolRank));
|
|
|
+
|
|
|
// 融合排序
|
|
|
return mergeAndSort(param, rovRecallRank, flowPoolRank);
|
|
|
}
|
|
@@ -188,10 +197,11 @@ public class RankService {
|
|
|
|
|
|
double flowPoolP = getFlowPoolP(param);
|
|
|
int flowPoolIndex = 0;
|
|
|
- int rovPoolIndex = param.getTopK() - 1;
|
|
|
+ int rovPoolIndex = param.getTopK();
|
|
|
|
|
|
for (int i = 0; i < param.getSize() - param.getTopK(); i++) {
|
|
|
double rand = RandomUtils.nextDouble(0, 1);
|
|
|
+ log.info("rand={}, flowPoolP={}", rand, flowPoolP);
|
|
|
if (rand < flowPoolP) {
|
|
|
if (flowPoolIndex < flowPoolRank.size()) {
|
|
|
result.add(flowPoolRank.get(flowPoolIndex++));
|