开发者

Help to create a Sort by Top algorithm

I'm working on an intranet site for my company and I need to add a module that will list drawings done by the employee's children. Each employee can upload any number of drawings and a random drawing will appear on the home page of the intranet every time it is loaded.

There will be a "Like" button next to each drawing and every click to that button will count a vo开发者_如何学编程te to the drawing.

There will also be a "Top Drawings" section where of course the drawings will be sorted by "Top".

The problem is... I'm not sure what would define a drawing to be in the top, what I have so far is sort by votes, which is not fair because a drawing posted 1 month ago has a lot of votes and a drawing posted today will be very unlikely to get more votes that the 1 month old one.

Any help will be very appreciated!

Each user can vote just once, (the company has a lot of employees), I don't store how many views the drawing has (should I?).

I'm not sure what formula to use... I think that new uploaded drawings should have the opportunity to be in the top list too, right?

Thanks!


XKCD's Randall Munroe has an excellent article on how reddit handles exactly this, here. That article links to this one, which covers all the naive approaches, describes their downfalls, then goes on to explain how to build a rating system that actually works how you want it to.


I would go with an averaged rating, excluding drawings that didn't get a certain number of votes. That way, if a drawing only got one vote, but it was 5 stars, it wouldn't automatically win. Something like:

if votes >= minVotes:
    score = sum(ratings)/votes


You could sort by recent votes. So newer drawings that are getting votes now will sort ahead of older drawings. A lot of sites have multiple "Top" lists, arranged by time frame. Like "Top this week," "this month," and "all time."

If you can only have one "top" list, then you could "age" the older drawings. So a drawing that has 10 votes but is a month old might get an age multiplier of 0.8, whereas a new drawing would have a multiplier of 1.0.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜