{
  "id": 5684,
  "title": "Evaluation metric",
  "url": "/competitions/expedia-personalized-sort/discussion/5684",
  "author_name": "",
  "post_date": "2013-09-06T22:56:02.763Z",
  "votes": null,
  "comment_count": 23,
  "views": 10178,
  "content": "<p>Hello,</p>\n<p>&nbsp;</p>\n<p>The Evaluation page says:</p>\n<p style=\"padding-left: 30px\"><em>Hotels for each user query are assigned relevance grades as follows:</em></p>\n<p style=\"padding-left: 30px\"><em>5 - The user purchased a room at this hotel</em><br><em>1 - The user clicked through to see more information on this hotel</em><br><em>0 - The user neither clicked on this hotel nor purchased a room at this hotel</em></p>\n<p>&nbsp;</p>\n<p><span style=\"line-height: 1.4\">Does a hotel that gets clicked AND booked get 5 or 6? (Is the numerator of the DCG formula 31 or 63?)</span></p>\n<p>&nbsp;</p>\n<p>Thank you.</p>",
  "messages": [
    {
      "id": "30379",
      "postDate": "09/06/2013 22:56:02",
      "content": "<p>Hello,</p>\n<p>&nbsp;</p>\n<p>The Evaluation page says:</p>\n<p style=\"padding-left: 30px\"><em>Hotels for each user query are assigned relevance grades as follows:</em></p>\n<p style=\"padding-left: 30px\"><em>5 - The user purchased a room at this hotel</em><br><em>1 - The user clicked through to see more information on this hotel</em><br><em>0 - The user neither clicked on this hotel nor purchased a room at this hotel</em></p>\n<p>&nbsp;</p>\n<p><span style=\"line-height: 1.4\">Does a hotel that gets clicked AND booked get 5 or 6? (Is the numerator of the DCG formula 31 or 63?)</span></p>\n<p>&nbsp;</p>\n<p>Thank you.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "30404",
      "postDate": "09/07/2013 04:00:54",
      "content": "<p>Bookings override clickings, so 5</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "30970",
      "postDate": "09/16/2013 13:43:06",
      "content": "<p>I want to make sure that I am computing the evaluation metric correctly. I have a set of questions:</p>\n<ul>\n<li>Do I set k = 38 when using the formula given on&nbsp;https://www.kaggle.com/wiki/NormalizedDiscountedCumulativeGain</li>\n<li>If I do set k = 38, and only have 5 hotels in the search-query, should I just have relevance = 0 for the 33 last terms of the sum, consequently making them all 0?</li>\n<li>Can anybody shed some light on the computation of IDCG? Currently I will - for the ideal ranking - rank the booked hotel first, and then followed by all the hotels that were just clicked on, and then compute the DCG for that ranking. Is this correct?</li>\n</ul>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "30984",
      "postDate": "09/16/2013 16:23:39",
      "content": "<p>All of those are correct.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "30993",
      "postDate": "09/16/2013 18:35:39",
      "content": "<p>One of the reasons I was asking is because there is a rather large discrepancy between my scores on the leaderboard and the scores I get when predicting on the training set. A rather simple approach/baseline gives me 0.378 on the leaderboard and around 0.267 when I use the first 1,000,000 lines of the training set. I would expect something a little closer than this - and as far as I can see, I am computing the evaluation metric correctly.</p>\n<p>Is anybody else experiencing trouble with getting realistic/trustworthy scores on the training set?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31013",
      "postDate": "09/16/2013 21:37:28",
      "content": "<p>My CV scores are pretty close to the leaderboard. You could try calculating NDCG manually in excel and checking that against your code. My NDCG function is about 40 lines long, it would be easy to screw something up in there.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31169",
      "postDate": "09/19/2013 10:23:26",
      "content": "<p>Here the code for NDCG in R (2Ben: I could not find this metric in Metrics package :)</p>\n<p>#x is a vector of relevance scores<br>ndcg &lt;- function(x) {<br>&nbsp;&nbsp; ideal_x &lt;- rev(sort(x))<br>&nbsp;&nbsp; dcg &lt;- function(y) sum((2^y - 1)/log(2:(length(y)+1), base = 2))<br>&nbsp;&nbsp; dcg(x)/dcg(ideal_x)<br>}</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31329",
      "postDate": "09/22/2013 04:39:36",
      "content": "<p>I would like to make sure that my understanding is correct - what do you get for the train set in the original sort order? I have 0.3393.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31453",
      "postDate": "09/24/2013 05:28:30",
      "content": "<p>so close to leadboard!&nbsp;&nbsp; can you share how you do cv?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31468",
      "postDate": "09/24/2013 10:57:28",
      "content": "<h3><span style=\"text-decoration: underline\">This leader board is calculated on approximately 25% of the test data.</span></h3>\n<p>&nbsp;</p>\n<p>Is this 25% selected randomly for each submission?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31472",
      "postDate": "09/24/2013 11:13:18",
      "content": "<p>No, it is fixed for all submissions.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31473",
      "postDate": "09/24/2013 11:14:45",
      "content": "<p>[quote=Vikas Bhargava (LatentView);31468]</p>\n<h3><span style=\"text-decoration: underline\">This leader board is calculated on approximately 25% of the test data.</span></h3>\n<p>&nbsp;</p>\n<p>Is this 25% selected randomly for each submission?</p>\n<p>[/quote]</p>\n<p>The random sample is the same for everybody. All submissions are evaluated against the same sample.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31916",
      "postDate": "10/02/2013 11:19:03",
      "content": "<p>Hi all</p>\n<p>Computing NDCG for single search result set is quite straingtforward, having in mind this forum so far.</p>\n<p>Still, it is not clear to me how all NDCG values for each search are combined into score for the submission with many searches?</p>\n<p>X</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31932",
      "postDate": "10/02/2013 13:35:35",
      "content": "<p>I think that if there are 100 searches, you'd add up the individual ndcg scores and then divide by 100. Your score is the mean of your individual search scores</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31956",
      "postDate": "10/02/2013 22:47:23",
      "content": "<p>My Code in Python With Multiprocesser&nbsp;</p>\n<p>&nbsp;</p>\n<p>import math</p>\n<p>import multiprocessing</p>\n<p>CPU = 4</p>\n<p>def deg(rel):<br>&nbsp; &nbsp; # rel: list of relevance<br>&nbsp; &nbsp; d = rel[0]<br>&nbsp; &nbsp; length = len(rel)<br>&nbsp; &nbsp; for i in range(1, length):<br>&nbsp; &nbsp; &nbsp; &nbsp; d += rel[i] / math.log(i + 1, 2)<br>&nbsp; &nbsp; return d</p>\n<p>def ndcg(rel):<br>&nbsp; &nbsp; # rel: list of relevances<br>&nbsp; &nbsp; irel = sorted(rel, reverse = True)<br>&nbsp; &nbsp; return dcg(rel) / dcg(irel)</p>\n<p>def _single_ndcg(sid, rel):<br>&nbsp; &nbsp; return sid, ndcg(rel)</p>\n<p>def batch_ndcg(rels):<br>&nbsp; &nbsp; # rels: touples of (key, rel), rel is a list<br>&nbsp; &nbsp; pool = multiprocessing.Pool(CPU)<br>&nbsp; &nbsp; ndcgs = {}<br>&nbsp; &nbsp; for sid, value in pool.imap_unordered(_single_ndcg, rels, chunksize=1000):<br>&nbsp; &nbsp; &nbsp; &nbsp; ndcgs[sid] = value<br>&nbsp; &nbsp; score = 0<br>&nbsp; &nbsp; keys = ndcgs.keys()<br>&nbsp; &nbsp; for sid in keys:<br>&nbsp; &nbsp; &nbsp; &nbsp; score += ndcgs[sid]<br>&nbsp; &nbsp; return score * 1.0 / len(keys)</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31972",
      "postDate": "10/03/2013 06:33:36",
      "content": "<p>How to evaluate NDCG if the user didn't book or click any of the hotel? In this case, both DCG and IDCG will be 0, so I am wondering are we going to let NDCG=1 since any rank will be the same as best rank, or remove this search when averaging individual NDCGs, or do something else?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "31983",
      "postDate": "10/03/2013 12:25:37",
      "content": "<p>I have the same problem with different scores over train data and official score for my submissions.</p>\n<p>Did you find solution/reason for this?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "32035",
      "postDate": "10/04/2013 19:25:16",
      "content": "<p>Based on my own observation, all srch_ids have at least one click_bool==1. So there won't be 0/0 situation.</p>\n<p>For those interested, here is my R code. It gets about .49xx on the training data.</p>\n<p>my_ndcg&lt;-function(rel, idx, orderby, k=1000){<br>&nbsp; d&lt;-data.frame(rel=rel, idx=idx, one=1, o=orderby)<br>&nbsp; d&lt;-d[order(d$idx, -d$rel),]<br>&nbsp; d$co&lt;-with(d, unlist(tapply(one, idx, cumsum)))<br>&nbsp; d$v&lt;-with(d, (2^rel-1)/(log(co+1, 2)))<br>&nbsp; #print(head(d, 20))<br>&nbsp; dcg0&lt;-with(d[d$co&lt;=k,], unlist(tapply(v, idx, sum)))<br>&nbsp; d&lt;-d[order(d$idx, d$o),]<br>&nbsp; d$co&lt;-with(d, unlist(tapply(one, idx, cumsum)))<br>&nbsp; d$v&lt;-with(d, (2^rel-1)/(log(co+1, 2)))<br>&nbsp; #print(head(d, 20))<br>&nbsp; #dcg&lt;-sum(d$v[d$co&lt;=k])<br>&nbsp; dcg&lt;-with(d[d$co&lt;=k,], unlist(tapply(v, idx, sum)))<br>&nbsp; return(mean(dcg/dcg0))<br>}</p>\n<p>#sample call</p>\n<p>with(train, my_ndcg(rel, srch_id, -pred, 38))</p>\n<p>XXX</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "32066",
      "postDate": "10/06/2013 15:13:34",
      "content": "<p>Can anyone enlighten me why the K needs to be set 38?&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "32068",
      "postDate": "10/07/2013 00:23:02",
      "content": "<p>Sorry for the&nbsp;dumb question. I found it. &quot;http://www.kaggle.com/c/expedia-personalized-sort/details/evaluation&quot;</p>\n<p>&quot;NDCG@38 is per query and averaged over all queries.&quot;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "32238",
      "postDate": "10/11/2013 02:01:16",
      "content": "<p>does anybody have this metric implemented in c++?</p>\n<p>&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "32299",
      "postDate": "10/13/2013 00:23:57",
      "content": "<p>Owen, thanks for posting your code. Apologies if I'm being dense, but a couple of clarifying questions for you.&nbsp;In this instance, rel is an rank ordered list of property id's, idx is the srch_id corresponding to each rank ordered list, correct? What does the orderby parameter mean and why is it used with &quot;-pred&quot; in the call?</p>\n<p>Not familiar with this metric and just trying to get my head around this conceptually...really appreciate any help, thanks!</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "32302",
      "postDate": "10/13/2013 04:27:54",
      "content": "<p>@swaller:</p>\n<p>rel is the actual value, i.e., rel=5 for booking=1, and rel=1 for booking=0,click=1</p>\n<p>orderby parameter is the &quot;prediction&quot;, i.e., the value that determines the ranking of the observations within each srch_id. The negative sign is there because my &quot;pred&quot; is the probability of events, thus taking negative will rank the most likely positive events first.</p>\n<p>The better &quot;orderby&quot; ranks &quot;rel&quot;, the higher the ndcg would be. If you use pred=-rel, you would get ndcg=1.</p>\n<p>Hope this answers your questions.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "32532",
      "postDate": "10/22/2013 15:21:18",
      "content": "<p>A few conceptual questions:</p>\n<p>1) When submitting, we don't give our predicted relevancy scores, only the order (pairs, of srch_id, prop_id) which are sorted within srch_id by our predicted relevancy. &nbsp;I understand this makes sense because if the real data was 5, 1, 0, and we predict 5,1,1 the order is the same even though we predicted the third would be clicked even if it wasn't actually.</p>\n<p>2) I have training data which I will split into a smaller training dataset and a validation dataset (the validation dataset would obviously have the actual relevancy scores). &nbsp;If I understand correctly, I am using the validation dataset to verify for myself how I am doing. &nbsp;I think the following is true but correct me if I'm wrong: the validation dataset should be sorted in order of actual relevancy, and then when I predict, my order may or may not follow the actual order. &nbsp;So then I use the ideal order of my predictions to calculate the NCDG. &nbsp;</p>\n<p>Basically when they evaluate our order, do they then combine our predictions with the test data, sort the dataset by srch_id then by actual relevancy, then compare our predicted order to the ideal order of our predictions?</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 30404,
      "author_name": "benhamner",
      "author_url": "",
      "post_date": "09/07/2013 04:00:54",
      "content": "<p>Bookings override clickings, so 5</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 30970,
      "author_name": "utdiscant",
      "author_url": "",
      "post_date": "09/16/2013 13:43:06",
      "content": "<p>I want to make sure that I am computing the evaluation metric correctly. I have a set of questions:</p>\n<ul>\n<li>Do I set k = 38 when using the formula given on&nbsp;https://www.kaggle.com/wiki/NormalizedDiscountedCumulativeGain</li>\n<li>If I do set k = 38, and only have 5 hotels in the search-query, should I just have relevance = 0 for the 33 last terms of the sum, consequently making them all 0?</li>\n<li>Can anybody shed some light on the computation of IDCG? Currently I will - for the ideal ranking - rank the booked hotel first, and then followed by all the hotels that were just clicked on, and then compute the DCG for that ranking. Is this correct?</li>\n</ul>",
      "votes": null,
      "replies": []
    },
    {
      "id": 30984,
      "author_name": "benhamner",
      "author_url": "",
      "post_date": "09/16/2013 16:23:39",
      "content": "<p>All of those are correct.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 30993,
      "author_name": "utdiscant",
      "author_url": "",
      "post_date": "09/16/2013 18:35:39",
      "content": "<p>One of the reasons I was asking is because there is a rather large discrepancy between my scores on the leaderboard and the scores I get when predicting on the training set. A rather simple approach/baseline gives me 0.378 on the leaderboard and around 0.267 when I use the first 1,000,000 lines of the training set. I would expect something a little closer than this - and as far as I can see, I am computing the evaluation metric correctly.</p>\n<p>Is anybody else experiencing trouble with getting realistic/trustworthy scores on the training set?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31013,
      "author_name": "bensolucky",
      "author_url": "",
      "post_date": "09/16/2013 21:37:28",
      "content": "<p>My CV scores are pretty close to the leaderboard. You could try calculating NDCG manually in excel and checking that against your code. My NDCG function is about 40 lines long, it would be easy to screw something up in there.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31169,
      "author_name": "efimov",
      "author_url": "",
      "post_date": "09/19/2013 10:23:26",
      "content": "<p>Here the code for NDCG in R (2Ben: I could not find this metric in Metrics package :)</p>\n<p>#x is a vector of relevance scores<br>ndcg &lt;- function(x) {<br>&nbsp;&nbsp; ideal_x &lt;- rev(sort(x))<br>&nbsp;&nbsp; dcg &lt;- function(y) sum((2^y - 1)/log(2:(length(y)+1), base = 2))<br>&nbsp;&nbsp; dcg(x)/dcg(ideal_x)<br>}</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31329,
      "author_name": "bebolino",
      "author_url": "",
      "post_date": "09/22/2013 04:39:36",
      "content": "<p>I would like to make sure that my understanding is correct - what do you get for the train set in the original sort order? I have 0.3393.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31453,
      "author_name": "dylanfan1",
      "author_url": "",
      "post_date": "09/24/2013 05:28:30",
      "content": "<p>so close to leadboard!&nbsp;&nbsp; can you share how you do cv?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31468,
      "author_name": "vikasbhargava",
      "author_url": "",
      "post_date": "09/24/2013 10:57:28",
      "content": "<h3><span style=\"text-decoration: underline\">This leader board is calculated on approximately 25% of the test data.</span></h3>\n<p>&nbsp;</p>\n<p>Is this 25% selected randomly for each submission?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31472,
      "author_name": "adamwoz",
      "author_url": "",
      "post_date": "09/24/2013 11:13:18",
      "content": "<p>No, it is fixed for all submissions.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31473,
      "author_name": "sashikanthdareddy",
      "author_url": "",
      "post_date": "09/24/2013 11:14:45",
      "content": "<p>[quote=Vikas Bhargava (LatentView);31468]</p>\n<h3><span style=\"text-decoration: underline\">This leader board is calculated on approximately 25% of the test data.</span></h3>\n<p>&nbsp;</p>\n<p>Is this 25% selected randomly for each submission?</p>\n<p>[/quote]</p>\n<p>The random sample is the same for everybody. All submissions are evaluated against the same sample.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31916,
      "author_name": "striki",
      "author_url": "",
      "post_date": "10/02/2013 11:19:03",
      "content": "<p>Hi all</p>\n<p>Computing NDCG for single search result set is quite straingtforward, having in mind this forum so far.</p>\n<p>Still, it is not clear to me how all NDCG values for each search are combined into score for the submission with many searches?</p>\n<p>X</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31932,
      "author_name": "totalnovice",
      "author_url": "",
      "post_date": "10/02/2013 13:35:35",
      "content": "<p>I think that if there are 100 searches, you'd add up the individual ndcg scores and then divide by 100. Your score is the mean of your individual search scores</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31956,
      "author_name": "binghsu",
      "author_url": "",
      "post_date": "10/02/2013 22:47:23",
      "content": "<p>My Code in Python With Multiprocesser&nbsp;</p>\n<p>&nbsp;</p>\n<p>import math</p>\n<p>import multiprocessing</p>\n<p>CPU = 4</p>\n<p>def deg(rel):<br>&nbsp; &nbsp; # rel: list of relevance<br>&nbsp; &nbsp; d = rel[0]<br>&nbsp; &nbsp; length = len(rel)<br>&nbsp; &nbsp; for i in range(1, length):<br>&nbsp; &nbsp; &nbsp; &nbsp; d += rel[i] / math.log(i + 1, 2)<br>&nbsp; &nbsp; return d</p>\n<p>def ndcg(rel):<br>&nbsp; &nbsp; # rel: list of relevances<br>&nbsp; &nbsp; irel = sorted(rel, reverse = True)<br>&nbsp; &nbsp; return dcg(rel) / dcg(irel)</p>\n<p>def _single_ndcg(sid, rel):<br>&nbsp; &nbsp; return sid, ndcg(rel)</p>\n<p>def batch_ndcg(rels):<br>&nbsp; &nbsp; # rels: touples of (key, rel), rel is a list<br>&nbsp; &nbsp; pool = multiprocessing.Pool(CPU)<br>&nbsp; &nbsp; ndcgs = {}<br>&nbsp; &nbsp; for sid, value in pool.imap_unordered(_single_ndcg, rels, chunksize=1000):<br>&nbsp; &nbsp; &nbsp; &nbsp; ndcgs[sid] = value<br>&nbsp; &nbsp; score = 0<br>&nbsp; &nbsp; keys = ndcgs.keys()<br>&nbsp; &nbsp; for sid in keys:<br>&nbsp; &nbsp; &nbsp; &nbsp; score += ndcgs[sid]<br>&nbsp; &nbsp; return score * 1.0 / len(keys)</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31972,
      "author_name": "jingweiwu",
      "author_url": "",
      "post_date": "10/03/2013 06:33:36",
      "content": "<p>How to evaluate NDCG if the user didn't book or click any of the hotel? In this case, both DCG and IDCG will be 0, so I am wondering are we going to let NDCG=1 since any rank will be the same as best rank, or remove this search when averaging individual NDCGs, or do something else?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 31983,
      "author_name": "striki",
      "author_url": "",
      "post_date": "10/03/2013 12:25:37",
      "content": "<p>I have the same problem with different scores over train data and official score for my submissions.</p>\n<p>Did you find solution/reason for this?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 32035,
      "author_name": "owenzhang1",
      "author_url": "",
      "post_date": "10/04/2013 19:25:16",
      "content": "<p>Based on my own observation, all srch_ids have at least one click_bool==1. So there won't be 0/0 situation.</p>\n<p>For those interested, here is my R code. It gets about .49xx on the training data.</p>\n<p>my_ndcg&lt;-function(rel, idx, orderby, k=1000){<br>&nbsp; d&lt;-data.frame(rel=rel, idx=idx, one=1, o=orderby)<br>&nbsp; d&lt;-d[order(d$idx, -d$rel),]<br>&nbsp; d$co&lt;-with(d, unlist(tapply(one, idx, cumsum)))<br>&nbsp; d$v&lt;-with(d, (2^rel-1)/(log(co+1, 2)))<br>&nbsp; #print(head(d, 20))<br>&nbsp; dcg0&lt;-with(d[d$co&lt;=k,], unlist(tapply(v, idx, sum)))<br>&nbsp; d&lt;-d[order(d$idx, d$o),]<br>&nbsp; d$co&lt;-with(d, unlist(tapply(one, idx, cumsum)))<br>&nbsp; d$v&lt;-with(d, (2^rel-1)/(log(co+1, 2)))<br>&nbsp; #print(head(d, 20))<br>&nbsp; #dcg&lt;-sum(d$v[d$co&lt;=k])<br>&nbsp; dcg&lt;-with(d[d$co&lt;=k,], unlist(tapply(v, idx, sum)))<br>&nbsp; return(mean(dcg/dcg0))<br>}</p>\n<p>#sample call</p>\n<p>with(train, my_ndcg(rel, srch_id, -pred, 38))</p>\n<p>XXX</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 32066,
      "author_name": "ericwu0",
      "author_url": "",
      "post_date": "10/06/2013 15:13:34",
      "content": "<p>Can anyone enlighten me why the K needs to be set 38?&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 32068,
      "author_name": "ericwu0",
      "author_url": "",
      "post_date": "10/07/2013 00:23:02",
      "content": "<p>Sorry for the&nbsp;dumb question. I found it. &quot;http://www.kaggle.com/c/expedia-personalized-sort/details/evaluation&quot;</p>\n<p>&quot;NDCG@38 is per query and averaged over all queries.&quot;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 32238,
      "author_name": "leustagos",
      "author_url": "",
      "post_date": "10/11/2013 02:01:16",
      "content": "<p>does anybody have this metric implemented in c++?</p>\n<p>&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 32299,
      "author_name": "swaller",
      "author_url": "",
      "post_date": "10/13/2013 00:23:57",
      "content": "<p>Owen, thanks for posting your code. Apologies if I'm being dense, but a couple of clarifying questions for you.&nbsp;In this instance, rel is an rank ordered list of property id's, idx is the srch_id corresponding to each rank ordered list, correct? What does the orderby parameter mean and why is it used with &quot;-pred&quot; in the call?</p>\n<p>Not familiar with this metric and just trying to get my head around this conceptually...really appreciate any help, thanks!</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 32302,
      "author_name": "owenzhang1",
      "author_url": "",
      "post_date": "10/13/2013 04:27:54",
      "content": "<p>@swaller:</p>\n<p>rel is the actual value, i.e., rel=5 for booking=1, and rel=1 for booking=0,click=1</p>\n<p>orderby parameter is the &quot;prediction&quot;, i.e., the value that determines the ranking of the observations within each srch_id. The negative sign is there because my &quot;pred&quot; is the probability of events, thus taking negative will rank the most likely positive events first.</p>\n<p>The better &quot;orderby&quot; ranks &quot;rel&quot;, the higher the ndcg would be. If you use pred=-rel, you would get ndcg=1.</p>\n<p>Hope this answers your questions.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 32532,
      "author_name": "statsguy",
      "author_url": "",
      "post_date": "10/22/2013 15:21:18",
      "content": "<p>A few conceptual questions:</p>\n<p>1) When submitting, we don't give our predicted relevancy scores, only the order (pairs, of srch_id, prop_id) which are sorted within srch_id by our predicted relevancy. &nbsp;I understand this makes sense because if the real data was 5, 1, 0, and we predict 5,1,1 the order is the same even though we predicted the third would be clicked even if it wasn't actually.</p>\n<p>2) I have training data which I will split into a smaller training dataset and a validation dataset (the validation dataset would obviously have the actual relevancy scores). &nbsp;If I understand correctly, I am using the validation dataset to verify for myself how I am doing. &nbsp;I think the following is true but correct me if I'm wrong: the validation dataset should be sorted in order of actual relevancy, and then when I predict, my order may or may not follow the actual order. &nbsp;So then I use the ideal order of my predictions to calculate the NCDG. &nbsp;</p>\n<p>Basically when they evaluate our order, do they then combine our predictions with the test data, sort the dataset by srch_id then by actual relevancy, then compare our predicted order to the ideal order of our predictions?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "30379": "",
    "30404": "",
    "30970": "",
    "30984": "",
    "30993": "",
    "31013": "",
    "31169": "",
    "31329": "",
    "31453": "",
    "31468": "",
    "31472": "",
    "31473": "",
    "31916": "",
    "31932": "",
    "31956": "",
    "31972": "",
    "31983": "",
    "32035": "",
    "32066": "",
    "32068": "",
    "32238": "",
    "32299": "",
    "32302": "",
    "32532": ""
  },
  "source": "meta"
}