# Relatively normalizing values for collaborative filtering

I am trying to derive a formula for my collaborative algorithm problem to calculate popularity rating of an item.

I am considering three factors to calculate rating for an item based on three different ratings $a$, $b$ and $c$, each with weight $w_1$, $w_2$ and $w_3$. The cumulative rating is:

$$w_1 a + w_2 b + w_3 c$$

In this equation, I want to give $b$ less weight than $a$, i.e. $w_1 > w_2 > w_3$.

But the problem is that how should I decide/calculate the weights such that they maintain this relative ordering when normalized (I am not looking for linear normalization) i.e.

$$w_1 a > w_2 b > w_3 c$$

Is there a way to calculate $w_1$, $w_2$, $w_3$ dynamically and what normalization process I should use or is recommended?

It would be really helpful to get comments on the approach as well.

-

## migrated from programmers.stackexchange.comJan 30 '12 at 11:48

This question came from our site for professional programmers interested in conceptual questions about software development.

So if I take an example of (5, 7, 4), we must have:

w1 × a > w2 × b > w3 × c
w1 × 5 > w2 × 7 > w3 × 4
▪ w1 > ⁷⁄₅ w2 and
▪ w3 < ⁷∕₄ w2


With more ratings, you will have:

with:

If you translate this to code, you'll easily find that you can choose each weight from it's neighbor. Since wₓ₋₁aₓ₋₁ > wₓaₓ, given aₓ₋₁ and aₓ, you can loop through a list starting from the first or the last item, and assign the weights accordingly.

Rating previous = this.Ratings.First();
foreach (Rating current in this.Ratings.Skip(1))
{
current.Weight = (previous.Weight * previous.Rating) / current.Rating - 1;
previous = current;
}

-
thanks. It has given me the necessary thought process to move ahead. –  krammer Jan 30 '12 at 12:04