ranking

Need help with SQL for ranking search results

心不动则不痛 提交于 2019-12-22 00:26:29
问题 I am trying to build a tiny exercise search engine using mysql. Each exercise can have an arbitrary number of search tags. Here is my data structure: TABLE exercises ID title TABLE searchtags ID title TABLE exerciseSearchtags exerciseID -> exercises.ID searchtagID -> searchtags.ID ...where exerciseSearchtags is a many to many join table expressing the relationship between exercises and searchtags. The search engine accepts an unknown number of user inputted keywords. I would like to rank

Ranking from pairwise comparisons [duplicate]

岁酱吖の 提交于 2019-12-21 17:30:08
问题 This question already has answers here : How to rank a million images with a crowdsourced sort (12 answers) Closed 5 years ago . Imagine I have a very long list of images and I want to rank them in order of how 'good' people think they are. I don't want to get users to assign scores to images outright (1 - 10 etc) and order by that, I'd like to try something new. What I was thinking would be an interesting way of doing it is: Show a user two random images, they pick the better one Collect

Best way to update user rankings without killing the server

江枫思渺然 提交于 2019-12-21 06:08:13
问题 I have a website that has user ranking as a central part, but the user count has grown to over 50,000 and it is putting a strain on the server to loop through all of those to update the rank every 5 minutes. Is there a better method that can be used to easily update the ranks at least every 5 minutes? It doesn't have to be with php, it could be something that is run like a perl script or something if something like that would be able to do the job better (though I'm not sure why that would be

Best way to update user rankings without killing the server

戏子无情 提交于 2019-12-21 06:07:19
问题 I have a website that has user ranking as a central part, but the user count has grown to over 50,000 and it is putting a strain on the server to loop through all of those to update the rank every 5 minutes. Is there a better method that can be used to easily update the ranks at least every 5 minutes? It doesn't have to be with php, it could be something that is run like a perl script or something if something like that would be able to do the job better (though I'm not sure why that would be

How to get item ranking in list sorted by multiple fields in Mongoose

主宰稳场 提交于 2019-12-21 00:28:53
问题 I have a number of user records (> 10000) in a MongoDB collection which can be sorted by score desc + time asc + bonus desc. How can I get the ranking of one user in the list according to this sorting using Mongoose? Assume index has been built correctly. 回答1: Count the number of users that come before this user in your sort order. I'll start with the case of a simple (non-compound sort) because the query in the compound case is more complicated, even though the idea is exactly the same. > db

Simple ranking algorithm

守給你的承諾、 提交于 2019-12-20 19:57:31
问题 I need to create a poll that is to create a ranking list of items in order of how good they are. I intend to show each user two items together and make them choose one which they think is better, and repeat the process multiple times over. It is sort of similar to what you could see in the Social Network movie. How should I be ranking the items based on the received answers? 回答1: Look at the ELO chess rating system if you want something fancy. 回答2: I think you can use the Elo Algorithm which

PHP MySQL Query most popular in last 24 hours

 ̄綄美尐妖づ 提交于 2019-12-20 14:39:41
问题 Say I want to get ten records with the MOST likes in the last 24 hours. Here's what I have so far: $date = date("o-m-d"); $query = "SELECT date_created,COUNT(to),from,to FROM likes WHERE date_created LIKE '$date%' GROUP BY to ORDER BY COUNT(to) DESC LIMIT 10"; The problem with that is that it only gets the most liked from THAT DAY, no matter how far into that day it is. It doesn't get the most liked from the last 24 hours. structure for likes: from | to | date_created | id dates are in

PHP MySQL Query most popular in last 24 hours

帅比萌擦擦* 提交于 2019-12-20 14:39:24
问题 Say I want to get ten records with the MOST likes in the last 24 hours. Here's what I have so far: $date = date("o-m-d"); $query = "SELECT date_created,COUNT(to),from,to FROM likes WHERE date_created LIKE '$date%' GROUP BY to ORDER BY COUNT(to) DESC LIMIT 10"; The problem with that is that it only gets the most liked from THAT DAY, no matter how far into that day it is. It doesn't get the most liked from the last 24 hours. structure for likes: from | to | date_created | id dates are in

Python implementation of the Wilson Score Interval?

霸气de小男生 提交于 2019-12-20 08:11:13
问题 After reading How Not to Sort by Average Rating, I was curious if anyone has a Python implementation of a Lower bound of Wilson score confidence interval for a Bernoulli parameter? 回答1: Reddit uses the Wilson score interval for comment ranking, an explanation and python implementation can be found here #Rewritten code from /r2/r2/lib/db/_sorts.pyx from math import sqrt def confidence(ups, downs): n = ups + downs if n == 0: return 0 z = 1.0 #1.44 = 85%, 1.96 = 95% phat = float(ups) / n return

Python implementation of the Wilson Score Interval?

爷,独闯天下 提交于 2019-12-20 08:11:12
问题 After reading How Not to Sort by Average Rating, I was curious if anyone has a Python implementation of a Lower bound of Wilson score confidence interval for a Bernoulli parameter? 回答1: Reddit uses the Wilson score interval for comment ranking, an explanation and python implementation can be found here #Rewritten code from /r2/r2/lib/db/_sorts.pyx from math import sqrt def confidence(ups, downs): n = ups + downs if n == 0: return 0 z = 1.0 #1.44 = 85%, 1.96 = 95% phat = float(ups) / n return