PDA

View Full Version : Math/Javascript question



Falkon303
03-27-2011, 06:41 AM
Ok,

so I have 3 variables -

1. views by users
2. days on website
3. +cool votes

I am trying to establish the correct averaging formula for finding out which topic/post is the coolest.

I *think* it would be the following

topic_name = 'cards article';
days = 43;
views = 13;
cool = 10;
popularity = views/days;
cool_vs_popularity = cool/popularity;
topic.push(topic_name);
rating.push(cool_vs_popularity);

It seems to work on my end, but I am double-checking to see if anyone sees it differently. "topic.push", and "rating.push" refer to arrays that would exist to house topics and ratings. Also if there is a way to pass the topic name variable along with the rating, but preferably without using a string delimiter.

jscheuer1
03-27-2011, 10:43 AM
Assuming all topics have an equal chance of being viewed, the math seems reasonable to me. What I've sometimes seen in situations like this though, regardless of the rating system, is that the topics listed first get the most views. Many people having little or no criteria to use in judging which topics to view lose interest in the page after a few topics.

You cannot pass a string without delimiters, but they are already included in the variable topic_name.

Unless you want to use one or more objects*, and as long as there is no way a topic can be added to the topic array without a rating being added to the rating array and visa versa, there should be a direct correlation via index between topic and rating.

However, there could perhaps be multiple listings in the topic array of any given topic_name correlated with multiple ratings for it in the rating array. If this is the case, any analysis of these arrays would want to find the last entry (index).


*javascript objects {}, as opposed to javascript arrays [].

Falkon303
03-27-2011, 10:46 PM
Thanks jscheuer1,

I noticed that about the rating systems out there. The main curve/issue is that if I have a topic that has been listed for 40 days, has 20 views and 14 cool votes vs a topic that has been listed for 3 days, has 7 views and 6 cool votes it seems to look "off" to have the topic that has been listed for 3 days be listed as a more popular article (even though it's a fact). I considered just using cool/views in order to be more fair, but then I have to consider the curveball thrown by the keywords they choose (and typos).

It's an odd thing, but you definitely helped clarify it for me. :)

- Ben