Sorting by Popularity?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ReGenesis0@aol.com

    Sorting by Popularity?

    This is... I guess more of a programming structure question than
    anything.
    How does one index the popularity of something? Overall usage? How
    does recent-term popularity come in? Is there an algorithm for
    weighting the popularity, or does one just index a popularity value for
    forever, 1 week, 1 day, etc? And in that case, how does one know when
    oldd 'hits' pass out of current consideration?

    I mean- this sort of problem has existed for twenty years. I'm
    TRUSTING (hoping) there is some sort of disgustingly elegant but
    anti-intuitive solution for this sort of thing I'm just not seeing.

    .....help?

    -Derik

  • bobzimuta

    #2
    Re: Sorting by Popularity?

    Filling out an application for Google, eh? ;)

    My 0.02 ( in the scope of ranking web pages ):

    I did an AI project where pages were dynamically ranked. I factored in
    a few things:

    1. direct clicks to a page
    2. keywords within the page that match what I was searching for.
    3. Relative position of keywords to other keywords on the page
    4. Number of links from the page
    5. Pages that linked to a clicked page

    For your algorithm, I think it depends on exactly what you are ranking.
    For instance, I will likely rank medical information differently than
    tech information. It depends on what your customers are looking for.

    Never the less, it's a fun topic to discuss.

    Comment

    • NC

      #3
      Re: Sorting by Popularity?

      ReGenesis0@aol. com wrote:[color=blue]
      >
      > How does one index the popularity of something?[/color]

      However one pleases.
      [color=blue]
      > I mean- this sort of problem has existed for twenty years.[/color]

      In fact, the problem has existed for several hundred years (at least
      since the start of book printing). The publishing industry, and later
      the sound recording indurstry and movie/video industry all measure
      popularity in a variety of ways.

      Let's take movies, for example. You can measure their popularity by
      how many people have seen it the first weekend after it came out, how
      many people have seen it in movie theaters, how long it's been playing
      in movie theaters, how many people purchased the DVD, and how many
      people rented the DVD...

      Records' popularity is measured in a similar variety of ways. You have
      weekly charts that reflect "instant" popularity (current week's rating,
      highest rating achieved, number of weeks the record stayed in the
      chart), but you also have lifetime recognition -- the Gold (500,000
      copies sold), Platinum (1,000,000 copies sold), and Diamond (10,000,000
      copies sold) awards...

      Cheers,
      NC

      Comment

      • ReGenesis0@aol.com

        #4
        Re: Sorting by Popularity?

        >Filling out an application for Google, eh?

        No, sub-genere web-directory. The idea is to let the members of a
        fandom index the several thousand pages online by category (multiple
        possible categories allowed per page) and have it auto-ranking.
        (in-category rank seperate from overall popularity, to prevent
        selection depth wash-out on the top 10's.)

        I take it your answer is- 'track several indices, and use an algorithm
        to average them out in some sane way.'

        Thus, I guess, I must ask again- is there an elegant way to teack 'just
        the hits in the last week,' essentiallg dropping the 'back-end' hits as
        they elapse past the hit-time, WITHOUT keeping an individual record of
        all hits over the course of the week?

        -Derik

        Comment

        • NC

          #5
          Re: Sorting by Popularity?

          ReGenesis0@aol. com wrote:[color=blue]
          >
          > I guess, I must ask again- is there an elegant way to teack 'just
          > the hits in the last week,' essentiallg dropping the 'back-end' hits
          > as they elapse past the hit-time, WITHOUT keeping an individual
          > record of all hits over the course of the week?[/color]

          You could try daily totals... Say, you have a MySQL table called hits:


          id (INT): Page ID
          date (DATE): Day for which you need to know the number of hits
          hits (INT): Hit count

          The table's primary key is a two-column index based on `id` and `date`.


          Every time a page is accessed, it does something like this:

          $date = date('Y-m-d');
          $id = [Page ID here];
          $query = "UPDATE `hits` SET `hits` = `hits` + 1 " .
          "WHERE `id`=$id AND `date`='$date' ";
          mysql_query($qu ery);

          Summing up the daily totals for the last seven days then becomes rather
          trivial:

          SELECT id, SUM(hits) AS score
          FROM hits
          WHERE date >= '[the first day of counting]'
          GROUP BY id
          ORDER BY score DESC;

          Chees,
          NC

          Comment

          • R. Rajesh Jeba Anbiah

            #6
            Re: Sorting by Popularity?

            NC wrote:[color=blue]
            > ReGenesis0@aol. com wrote:[color=green]
            > >
            > > I guess, I must ask again- is there an elegant way to teack 'just
            > > the hits in the last week,' essentiallg dropping the 'back-end' hits
            > > as they elapse past the hit-time, WITHOUT keeping an individual
            > > record of all hits over the course of the week?[/color]
            >
            > You could try daily totals... Say, you have a MySQL table called hits:[/color]

            <snip Nikolai Chuvakhin's MySQL solution>

            Say, for example, take a product search engine and it's core DB
            table:
            products: id, name, hits

            If the 'products' table is updated with hits count lively, it might
            affect performance; but certainly to rank the products we need such
            table structure. I don't have any idea, how it's done in some high
            traffic sites.

            But, when I last time dig on this subject, I read somewhere (or
            mistakenly understood) that such sites don't rely on DB. The product
            data is stored in filesystem with hash like system:

            c:\products\01\ product1.data
            \02\product2.da ta

            And it's been "indexed"--not sure, how it's indexed. The same
            technique is used by search engines(?). If anyone has any good
            experience on this topic, kindly share the architecture. I'm much
            curious.

            --
            <?php echo 'Just another PHP saint'; ?>
            Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

            Comment

            Working...