You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by ziad kamel <zi...@gmail.com> on 2012/04/04 22:35:55 UTC

What equation do NDCG used ?

Hi , I checked the code for NDCG and it seems not same as
http://en.wikipedia.org/wiki/Discounted_cumulative_gain
How that formula was derived ?

Thanks

Re: What equation do NDCG used ?

Posted by Sean Owen <sr...@gmail.com>.
No, re-read my last message. The ordering matters, since the discount
changes at each position.

On Wed, Apr 4, 2012 at 10:36 PM, ziad kamel <zi...@gmail.com> wrote:
> It seems that having a recommended list that is for example
>
> 9, 23, 8
> or
> 8 , 9 , 23
> will give same NDGC , since it just have to be within the relevant
> list . NDGC usually being used in ranking lists , that is why I think
> relevant 0 or 1 won't work.

Re: What equation do NDCG used ?

Posted by ziad kamel <zi...@gmail.com>.
It seems that having a recommended list that is for example

9, 23, 8
or
8 , 9 , 23
will give same NDGC , since it just have to be within the relevant
list . NDGC usually being used in ranking lists , that is why I think
relevant 0 or 1 won't work.



On Wed, Apr 4, 2012 at 4:23 PM, Sean Owen <sr...@gmail.com> wrote:
> It does use the order:
>
> double discount = i == 0 ? 1.0 : 1.0 / log2(i + 1);
>
> The "score" you gain for recommending a relevant item decreases as you
> go down the list of recommendations.
>
> As the comments in the code note, relevance is 1 for relevant items
> and 0 for others. There is no point in showing a term multiplied by 1,
> or 0.
>
> On Wed, Apr 4, 2012 at 10:19 PM, ziad kamel <zi...@gmail.com> wrote:
>> DCG should check the order and the formula seems not , just check if
>> it contains the item
>>
>>  if (relevantItemIDs.contains(item.getItemID())) {
>>          cumulativeGain += discount;
>>        }
>>
>> Second thing is that it have a relevance number "rel" which the
>> formula don't use.
>>
>>
>>
>>
>> On Wed, Apr 4, 2012 at 3:54 PM, Sean Owen <sr...@gmail.com> wrote:
>>> It's the same formula, what do you think is different?
>>>
>>> On Wed, Apr 4, 2012 at 9:35 PM, ziad kamel <zi...@gmail.com> wrote:
>>>> Hi , I checked the code for NDCG and it seems not same as
>>>> http://en.wikipedia.org/wiki/Discounted_cumulative_gain
>>>> How that formula was derived ?
>>>>
>>>> Thanks

Re: What equation do NDCG used ?

Posted by Sean Owen <sr...@gmail.com>.
It does use the order:

double discount = i == 0 ? 1.0 : 1.0 / log2(i + 1);

The "score" you gain for recommending a relevant item decreases as you
go down the list of recommendations.

As the comments in the code note, relevance is 1 for relevant items
and 0 for others. There is no point in showing a term multiplied by 1,
or 0.

On Wed, Apr 4, 2012 at 10:19 PM, ziad kamel <zi...@gmail.com> wrote:
> DCG should check the order and the formula seems not , just check if
> it contains the item
>
>  if (relevantItemIDs.contains(item.getItemID())) {
>          cumulativeGain += discount;
>        }
>
> Second thing is that it have a relevance number "rel" which the
> formula don't use.
>
>
>
>
> On Wed, Apr 4, 2012 at 3:54 PM, Sean Owen <sr...@gmail.com> wrote:
>> It's the same formula, what do you think is different?
>>
>> On Wed, Apr 4, 2012 at 9:35 PM, ziad kamel <zi...@gmail.com> wrote:
>>> Hi , I checked the code for NDCG and it seems not same as
>>> http://en.wikipedia.org/wiki/Discounted_cumulative_gain
>>> How that formula was derived ?
>>>
>>> Thanks

Re: What equation do NDCG used ?

Posted by ziad kamel <zi...@gmail.com>.
DCG should check the order and the formula seems not , just check if
it contains the item

 if (relevantItemIDs.contains(item.getItemID())) {
          cumulativeGain += discount;
        }

Second thing is that it have a relevance number "rel" which the
formula don't use.




On Wed, Apr 4, 2012 at 3:54 PM, Sean Owen <sr...@gmail.com> wrote:
> It's the same formula, what do you think is different?
>
> On Wed, Apr 4, 2012 at 9:35 PM, ziad kamel <zi...@gmail.com> wrote:
>> Hi , I checked the code for NDCG and it seems not same as
>> http://en.wikipedia.org/wiki/Discounted_cumulative_gain
>> How that formula was derived ?
>>
>> Thanks

Re: What equation do NDCG used ?

Posted by Sean Owen <sr...@gmail.com>.
It's the same formula, what do you think is different?

On Wed, Apr 4, 2012 at 9:35 PM, ziad kamel <zi...@gmail.com> wrote:
> Hi , I checked the code for NDCG and it seems not same as
> http://en.wikipedia.org/wiki/Discounted_cumulative_gain
> How that formula was derived ?
>
> Thanks