Jump to content

Calculating popularity based on views and time


mattal999

Recommended Posts

Ok so I have an interesting question for all you coders out there... What I want to do is make a list of the most popular "pages" (for simplicity's sake lets call them pages even though they are files).

 

We have 5 pages. Each page is accessed using an id appended to the url. The table structure for each page:

 

id            | content                          | views                             

1            | this is page 1                  | 5

2            | this is page 2                  | 4

3            | this is page 3                  | 7

4            | this is page 4                  | 2

5            | this is page 5                  | 1

Now what I want to do, is make a system that calculates the most popular and least popular. Now I know that this can be done using the total views ordered descending, but this would not take current "trends" into account. I want to order the most popular pages over the most recent time period.

 

I have a simple system at the moment which takes views on today, yesterday and the day before and calculates a moving average on the fly (its not actually an average, just a total of the 3 days), which works ok, but fails if there are no views in the past 3 days. Does anyone have an idea how I could make a more complicated system that would serve purpose.

 

If you still don't get it, then look at Spotify. They have a popularity meter for each one of their songs, which shows what songs are "trending" and what songs are not. This is exactly what I want. My inner mathematician tells me that this is going to involve some sort of weighting, and i'm up for trying anything.

 

Thanks in advance, and if there is anything you need me to explain in more detail then just post a reply and i'll see what I can do.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.