PHP/MySQL - “最高评级”算法

发布于 2024-08-04 11:27:39 字数 390 浏览 6 评论 0原文

所以我只是建立了一个星级评级系统,并尝试提出一种算法来列出“最高评级”的项目。为简单起见,以下是专栏:

item_name
average_rating (a decimal from 1 to 5)
num_votes

我试图确定票数和评级之间的“最佳点”。例如...

  • 评分为(4.6 / 20 票)的项目在列表中应高于评分为(5.0 / 2 票)的项目
  • 评分为(2.5 / 100 票)的项目应低于评分为(4.5 / 2 票)的项目)

换句话说,num_votes 是“热门”的一个因素。

有人知道一种非常擅长确定这个“最佳位置”的算法吗?

提前致谢。

So I just built a star-rating system and and trying to come up with an algorithm to list the "Top Rated" items. For simplicity, here are the columns:

item_name
average_rating (a decimal from 1 to 5)
num_votes

I'm trying to determine the "sweet spot" between number of votes and rating. For example...

  • An item rated (4.6 / 20 votes) should be higher on the list than an item that's (5.0 / 2 votes)
  • An item rated (2.5 / 100 votes) should be below an item that's (4.5 / 2 votes)

So in other words, num_votes plays a factor in what's "Top".

Anyone know of an algorithm that is pretty good at determining this "sweet spot"?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

久隐师 2024-08-11 11:27:39

这是另一种从统计角度来看听起来不错的方法: http://www.thebroth.com/blog/118 /贝叶斯评级

here's another, statistically sound good way: http://www.thebroth.com/blog/118/bayesian-rating

予囚 2024-08-11 11:27:39

问题是,4.6/20 的评级应比 5.0/2 高多少...

一个想法是不要考虑没有至少 x 票的项目。

另一个想法是用“中等”票来填补。确定最少 10 票。 5.0/2 必须填满 8 个 2.5 的虚拟选票

5.0/2 意味着 2 个 5.0 的选票,加上 8 个 2.5 的选票,您将得到 30/10 -> 3.0 ;)

现在,您必须决定一个项目至少应有多少票。对于已经获得最低票数的,进行直接比较。

4.5/20 > 4.4/100
5.0/2  < 3.1/20  (as 5.0/2 is, as we calculated, 3.0/10)

The question is, how much higher the 4.6/20 shall be rated than the 5.0/2...

An idea not to take items in consideration that do not have at least x votes.

Another idea is to fill up with "medium" votes. Decide that 10votes shall be the minimum. The 5.0/2 must be filled with 8 virtual votes of 2.5

5.0/2 means 2 votes with 5.0, add 8 with 2.5 you'll get 30/10 -> 3.0 ;)

Now, you have to decide how many votes an item shall at least have. For those that already have the minimum votes, a direct comparation shall be done.

4.5/20 > 4.4/100
5.0/2  < 3.1/20  (as 5.0/2 is, as we calculated, 3.0/10)
薄荷梦 2024-08-11 11:27:39

您给每 10 票的权重为 1,那么 20 票的权重为该项目 2。
那么如果该物品的重量为 0,它将比平均值减少 0.5

4.6/20 = 20/10: 2 weight
5.0/2 = 2/10: 0 weight

(4.6 * 0.02) + 4.6 = 4.692
(5.0 * 0.00) + 5.0 = 5 - 0.5 = 4.5

2.5/100 = 100/10: 10 weight
4.5/2 = 2/10: 0 weight

(2.5 * 0.1) + 2.5 = 2.75
(4.5 * 0.0) + 4.5 = 4.5 - 0.5 = 4

How about you give each 10 votes a weight of 1 so 20 votes gives the item 2 weight.
Then if the item has 0 weight it will loose 0.5 from the average

4.6/20 = 20/10: 2 weight
5.0/2 = 2/10: 0 weight

(4.6 * 0.02) + 4.6 = 4.692
(5.0 * 0.00) + 5.0 = 5 - 0.5 = 4.5

2.5/100 = 100/10: 10 weight
4.5/2 = 2/10: 0 weight

(2.5 * 0.1) + 2.5 = 2.75
(4.5 * 0.0) + 4.5 = 4.5 - 0.5 = 4
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文