Results 1 to 3 of 3

Thread: Math/Javascript question

  1. #1
    Join Date
    Sep 2008
    Posts
    119
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Red face Math/Javascript question

    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.
    Last edited by Falkon303; 03-27-2011 at 06:58 AM.
    document.write is document.wrong

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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 [].
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2008
    Posts
    119
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    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
    document.write is document.wrong

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •