tags:

views:

56

answers:

2

Hi there,

I'm trying to convert this adaptive bayesian rating formula into PHP code.. http://cl.ly/cabd3372e2860b52e3db

Here are the details of the various parts of the formula..

  • nvotes : total number of votes so far
  • nlinks : total number of links
  • nvotes(k) : number of votes cast to rth link.
  • deltarank(k, m) : rank increment caused by kth vote that is casted to mth link.
  • nsaves(i) : number of users that save ith link to their linkibol.
  • a : save exponent (an ad-hoc value close to 1)
  • age(i) : the difference (in days) between date link added and current date.
  • b : decay exponent (an ad-hoc value close to 0)

(full details of the formula can be found at http://blog.linkibol.com/2010/05/07/how-to-build-a-popularity-algorithm-you-can-be-proud-of/ - scroll down to the "How Do We Implement Popularity in linkibol?" section)

I can convert most of this function into PHP code easily, but the bit I'm not understanding is the sigma and deltarank bit. I'm not sure what that bit is supposed to do or what values to pass to k and m.

If anyone has any tips or could break the complex bit of the formula down that'd be great, then I can look at what would be the best way to implement it in PHP - there might be functions I could make use of etc..

+1  A: 

They define the delta rank as the change in rank when the kth vote is cast on the mth link... it seems like that's arbitrary, since their rank change is based on the karma of the users casting the vote.

As for the sigma, it's just the sum of the contents from (k=1) to (k=whatever), so you'll implement that with a loop.

Sam Dufel
I understand it's based on the karma, I'm just not sure what the parameters k and m represent (kth vote and mth link). Is the sigma bit affected by the deltarank bit? I know sigma doesn't have to increment 1 integer at a time, so I'm wondering if it's affected by the value returned by deltarank..
RichW
k and m are the current index in the loops - if you look at the initial values for the sigmas, one starts with k=1 and the other starts with m=1. And yes, a sigma like that does increment 1 integer at a time.
Sam Dufel
+1  A: 

The sigma part is summation. Use the values provided as the loop counter. (so k=1 to 10, use those values in the functions that take k).

Delta is simply a difference, but that particular function surely has a more precise definition.

JoshD
I suppose an alternative to the loop counter would be array_sum() - I think that'd have the same effect. Interesting thoughts about the delta function - do you think there's more calculations behind it that just aren't show on that formula? I'm still trying to figure out what the deltarank represents..
RichW