Commit 488a1b72 authored by 刘基明's avatar 刘基明

热度算法优化 参数

parent 58b6eaec
...@@ -48,17 +48,19 @@ public class RankService { ...@@ -48,17 +48,19 @@ public class RankService {
@Value("${rank.theme.initialWeight:1.0}") @Value("${rank.theme.initialWeight:1.0}")
public Double initialWeight; public Double initialWeight;
//时间系数 //时间系数
@Value("${rank.theme.timeRaten:0.2}") @Value("${rank.theme.timeRate:0.2}")
public Double timeRate; public Double timeRate;
@Value("${rank.topic.viewRate:1}") @Value("${rank.topic.viewRate:1}")
public Double viewRateTopic; public Double topicViewRate;
@Value("${rank.topic.discussRate:3}") @Value("${rank.topic.discussRate:3}")
public Double discussRateTopic; public Double topicDiscussRate;
@Value("${rank.topic.themeRate:1}")
public Double topicThemeRate;
//时间系数 //时间系数
@Value("${rank.theme.timeRaten:1}") @Value("${rank.theme.timeRate:1}")
public Double timeRateTopic; public Double topicTimeRate;
@Autowired @Autowired
private ThemeService themeService; private ThemeService themeService;
...@@ -267,9 +269,9 @@ public class RankService { ...@@ -267,9 +269,9 @@ public class RankService {
if (topic.getIsTop() > 0) { if (topic.getIsTop() > 0) {
topic.setScore(Double.MAX_VALUE); topic.setScore(Double.MAX_VALUE);
} }
Double socre = ((topic.getDisscussCount() * discussRateTopic + topic.getViewCount() * viewRateTopic) Double socre = ((topic.getDisscussCount() * topicDiscussRate + topic.getViewCount() * topicViewRate)
/ Math.pow(topic.getHoursTillNow() + 1, timeRateTopic)) / Math.pow(topic.getHoursTillNow() + 1, topicTimeRate))
+ topic.getThemeWeight(); + topic.getThemeWeight() * topicThemeRate;
topic.setScore(socre); topic.setScore(socre);
} }
} }
...@@ -105,4 +105,9 @@ rank: ...@@ -105,4 +105,9 @@ rank:
collectRatio: 3 collectRatio: 3
userWeightRatio: 0.9 userWeightRatio: 0.9
initialWeight: 1.0 initialWeight: 1.0
timeRation: 0.2 timeRation: 0.2
\ No newline at end of file topic:
viewRate: 2
discussRate: 3
themeRate: 3
timeRate: 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment