算法选择从数据库中最热闹的地方数据库中、算法、热闹、地方

由网友(劇終〃)分享简介:我们有一个包含地方数据库的网站。对于每一个地方我们的用户能够采取后续行动,我们记录的一个:We have a website that contains a database of places. For each place our users are able to take one of the follow...

我们有一个包含地方数据库的网站。对于每一个地方我们的用户能够采取后续行动,我们记录的一个:

We have a website that contains a database of places. For each place our users are able to take one of the follow actions which we record:

查看 - 查看它的配置文件 等级 - 给它的规模为1-5星 审查 - 审查它 已完成 - 马克,他们已经在那里 在愿望清单 - 马克,他们希望去那里 收藏 - 马克,这是他们的最爱之一

在我们的数据库表的地方各地方包含倍每个动作上方拍摄的数量的计数以及由用户给定的平均评分

In our database table of places each place contains a count of the number of times each action above was taken as well as the average rating given by users.

的意见 评分 avg_rating 完成 的心愿 喜欢

我们希望能够做的就是生成使用上述信息前位的名单。理想情况下,我们希望能够产生使用相对简单的SQL查询本名单,而无需做任何跑腿来计算其他字段或堆栈秩地相互对抗。话虽这么说,因为我们只拥有约50000的地方,我们可以运行夜间cron​​作业来计算一些领域,如对不同类别的排名是否会作出有意义的差异,我们最重要的地方,整体效果。

What we want to be able to do is generate lists of the top places using the above information. Ideally, we would want to be able to generate this list using a relatively simple SQL query without needing to do any legwork to calculate additional fields or stack rank places against one another. That being said, since we only have about 50,000 places we could run a nightly cron job to calculate some fields such as rankings on different categories if it would make a meaningful difference in the overall results of our top places.

我倒是AP preciate如果你能做出我们应该如何看待冒泡顶端,我们应该体重更重其标准最好的地方提出了一些建议,并考虑到信息 - 暗示什么MySQL查询会需要看起来像以选择的前10位。

I'd appreciate if you could make some suggestions on how we should think about bubbling the best places to the top, which criteria we should weight more heavily, and given that information - suggest what the MySQL query would need to look like in order to select the top 10 places.

有一点需要注意的是,在这个时候,我们都不太关心的地方是受欢迎的近因 - 即着眼于综合信息是好的,而最近的数据并不需要进行更大的权重

One thing to note is that at this time we are less concerned with the recency of a place being popular - meaning that looking at the aggregate information is fine and that more recent data doesn't need to be weighted more heavily.

在此先感谢您的帮助和放大器;咨询!

Thanks in advance for your help & advice!

推荐答案

为喜爱的精确公式需要来自你,我们将它称为F(X)。 对于实际执行我想补充一个popularity_score场,我会计算,当你从一个夜间cron​​作业用F(X)为每行说。

The exact formula for the favorite would need to come from you, we will call it f(x). For the actual implementation I would add a popularity_score field that I would calculate, as you said from a nightly cron job using f(x) for each row.

然后,它仅仅是做一个由popularity_score递减,从表中的顺序选择地名的情况。

Then it is simply a case of doing a "select place name from table order by popularity_score desc".

确定 - 让我们给它一个刺 popularity_score =(FAVORITE * 3 *已完成2 +愿望清单+)*评级*查看/ AVG_VIEWS_OF_ALL_PROFILES

Ok - Let's give it a stab popularity_score = (FAVORITE * 3 + COMPLETED * 2 + WISHLIST) * RATING * VIEW / AVG_VIEWS_OF_ALL_PROFILES

阅读全文

相关推荐

最新文章