algorithmmathgraphrankingvoting

A Ranking algorithm


I need to sort some products base on user ratings.

Suppose we have 3 products {a,b,c} and we have user's feedbacks about this products. It's not important which user give us feedback (this question is not about correlative filtering if you are familiar with it - user interests is not the case here)

Each of these below lines is feedback from users when they tried to compare the 3 products:

a 150 points - b 0 points (this user just told us what he thinks of 2 products a and b and in comparison of a and b he thought that if he gives a 150 point then b worth 0 points)

a 150 points - c 20 points

c 200 points - a 10 points (despite the previous one this user thinks that c is better that a)

a 200 points - b 40 points - c 100 points

a 150 points - b 50 points

a 150 points - b 20 points

(These ratings are just a sample and in the real world number of products and ratings are much bigger than this)

Now I need an algorithm to find product's rankings based on user votes. In my point of view, the best way is to describe this problem with a correlation graph and connect all the products to each other.

Any kind of help or tips is appreciated.

/********************************************************************************/

You cannot just add the points and calculate the mean of product's points because it's important how it got his points. Suppose a has got 800 points against b - then c get 10 points against a like this:

a 200 - b 0

a 200 - b 0

a 200 - b 0

a 200 - b 0

c 10 - a 0 (this means that c is better than a)

so definitely a is better than b but with a small 10 points c got a better rank from a

/********************************************************************************/


Solution

  • You have some challenges. Add a ranking c 0 - b 20 and you got a circle, where c < b < a < c.

    And of course your order is not only not transitif ( from a < b < c does not follow a < c ), it is also not total (there might be elements you cannot decide which is better because no user voting has been done, even through other elements.

    What you get is a disconnected, directed, finite graph. (use the direction of the edges to say which element(node is better).

    Starting at a certain node you can find better nodes marching through the graph, maybe finding multiple non comparable solutions. If you visit the starting node again, stop processing that path.

    Maybe order theory in math can help you: look for order theory, partial order, Hasse diagram.

    To make this more practical:

    Use a two dimensional array with a row and a column per element. In the cell(a,b) calculate the sum of the ratings. Starting at a certain element a, follow all positiv (>0) connections, until you either reach a node that has no positiv connections or come back to a node you visited already. These nodes are your solutions.