{
  "id": 18944,
  "title": "Sharing Solution of Rank 23 (0.88625 on Private LB)",
  "content": "<p>For whoever is interested, here's my complete solution: <a href=\"https://github.com/rohanrao91/Kaggle_AirBnB\">https://github.com/rohanrao91/Kaggle_AirBnB</a></p>\n\n<p>Briefly:</p>\n\n<ol>\n<li><p>Built Logistic Regression on one-hot encoded features from sessions data as binary classifier for NDF vs non-NDF.</p></li>\n<li><p>Built XGBoost on raw features, one-hot encoded features from sessions data, the logistic regression predictions from (1), with some basic feature engineering, and combining of features.</p></li>\n<li><p>Didn't do too much of ensembling/blending/stacking since my CV and LB were not perfectly correlating, and hence stuck with these two single models. Plus, didn't have too much time :-)</p></li>\n<li><p>Takes about 20-25mins to run on my 4GB MacBook Air.</p></li>\n</ol>\n\n<p>Thanks to Kaggle and AirBnB for this fun challenge.\nCongratulations to the winners and special Thanks to everyone who share their ideas, models, scripts, codes and solutions in the spirit of learning and making the Kaggle forums extremely rich in knowledge.</p>",
  "comments": [
    {
      "id": 107957,
      "author_name": "Vopani",
      "author_url": "",
      "post_date": "2016-02-14T04:59:17.080000",
      "content": "<p>[quote=happydemiologist;107931]</p>\n\n<p>Thank you, Rohan. I've learned a few new things from your solution. I'm just curious: why did you create your own function for creating dummy variables rather than using model.matrix?\n[/quote]\nIts just an old habit. Had written that function few years ago when I wasn't aware of model.matrix. Just used to it and a bit lazy to change :-)</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 107933,
      "author_name": "W. Yifan",
      "author_url": "",
      "post_date": "2016-02-13T23:30:02.817000",
      "content": "<p>@Rohan Rao, Thank you for sharing, such a great opportunity to learn from you!</p>\n\n<p>Meanwhile I have following questions regarding your script:</p>\n\n<p>1,  Why did you do  X_test$country_destination &lt;- &quot;NDF&quot; ? Is is just because safer to be 'NDF' ?</p>\n\n<p>2,  I don't really understand what is the purpose of making 'sessions$count &lt;- 1' ? </p>\n\n<p>3,  When you '# merging some similar events into a single one', why did you divide by 10 after adding variables ?</p>\n\n<p>Really appreciate for your sharing and help !!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 107920,
      "author_name": "0.234",
      "author_url": "",
      "post_date": "2016-02-13T19:25:50.147000",
      "content": "<p>@ Rohan: It is a good idea to first classify NDF vs non-NDF. Thanks for sharing!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 107961,
      "author_name": "W. Yifan",
      "author_url": "",
      "post_date": "2016-02-14T05:34:47.957000",
      "content": "<p>@Rohan Rao\nThank you for your answer =) \nWill dig deeper to understand your point! ^_^</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 107959,
      "author_name": "Vopani",
      "author_url": "",
      "post_date": "2016-02-14T05:08:29.450000",
      "content": "<p>[quote=W. Yifan;107933]</p>\n\n<p>@Rohan Rao, Thank you for sharing, such a great opportunity to learn from you!</p>\n\n<p>Meanwhile I have following questions regarding your script:</p>\n\n<p>1,  Why did you do  X_test$country_destination &lt;- &quot;NDF&quot; ? Is is just because safer to be 'NDF' ?</p>\n\n<p>2,  I don't really understand what is the purpose of making 'sessions$count &lt;- 1' ? </p>\n\n<p>3,  When you '# merging some similar events into a single one', why did you divide by 10 after adding variables ?</p>\n\n<p>Really appreciate for your sharing and help !!\n[/quote]</p>\n\n<p>1) Its just a dummy value so that train and test have equal number of columns and its easier to rbind. You can set it as X_test$country_destination &lt;- &quot;Yifan&quot; and the code will still run fine :-)</p>\n\n<p>2) Again, just a dummy value due to the way dcast works. I'm sure there are cleaner ways of dummifying the action variables, I didn't optimize the code since it doesn't take long to run.</p>\n\n<p>3) Ohhh yes, thats a stupid thing. I wasn't able to code 'max' :-|\nBasically, what I wanted to do is take the maximum value of all those variables... so adding, dividing-by-10 and taking ceiling is a hackish version of 'max', and works only since all values are 0 and 1.</p>\n\n<p>You can divide by any number larger than the number of variables... like replacing 10 by 100 or 999.</p>\n\n<p>Maybe someone can help me figuring out how to take max of multiple variables?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 107931,
      "author_name": "",
      "author_url": "",
      "post_date": "2016-02-13T22:04:34.983000",
      "content": "<p>Thank you, Rohan. I've learned a few new things from your solution. I'm just curious: why did you create your own function for creating dummy variables rather than using model.matrix?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 107910,
      "author_name": "",
      "author_url": "",
      "post_date": "2016-02-13T18:44:05.193000",
      "content": "",
      "votes": 1,
      "replies": []
    }
  ],
  "comment_count": 7,
  "messages": [
    {
      "id": 107899,
      "postDate": "2016-02-13T16:20:44.037Z",
      "content": "<p>For whoever is interested, here's my complete solution: <a href=\"https://github.com/rohanrao91/Kaggle_AirBnB\">https://github.com/rohanrao91/Kaggle_AirBnB</a></p>\n\n<p>Briefly:</p>\n\n<ol>\n<li><p>Built Logistic Regression on one-hot encoded features from sessions data as binary classifier for NDF vs non-NDF.</p></li>\n<li><p>Built XGBoost on raw features, one-hot encoded features from sessions data, the logistic regression predictions from (1), with some basic feature engineering, and combining of features.</p></li>\n<li><p>Didn't do too much of ensembling/blending/stacking since my CV and LB were not perfectly correlating, and hence stuck with these two single models. Plus, didn't have too much time :-)</p></li>\n<li><p>Takes about 20-25mins to run on my 4GB MacBook Air.</p></li>\n</ol>\n\n<p>Thanks to Kaggle and AirBnB for this fun challenge.\nCongratulations to the winners and special Thanks to everyone who share their ideas, models, scripts, codes and solutions in the spirit of learning and making the Kaggle forums extremely rich in knowledge.</p>",
      "rawMarkdown": "For whoever is interested, here's my complete solution: https://github.com/rohanrao91/Kaggle_AirBnB\r\n\r\nBriefly:\r\n\r\n1. Built Logistic Regression on one-hot encoded features from sessions data as binary classifier for NDF vs non-NDF.\r\n\r\n2. Built XGBoost on raw features, one-hot encoded features from sessions data, the logistic regression predictions from (1), with some basic feature engineering, and combining of features.\r\n\r\n3. Didn't do too much of ensembling/blending/stacking since my CV and LB were not perfectly correlating, and hence stuck with these two single models. Plus, didn't have too much time :-)\r\n\r\n4. Takes about 20-25mins to run on my 4GB MacBook Air.\r\n\r\nThanks to Kaggle and AirBnB for this fun challenge.\r\nCongratulations to the winners and special Thanks to everyone who share their ideas, models, scripts, codes and solutions in the spirit of learning and making the Kaggle forums extremely rich in knowledge.\r\n",
      "votes": 9
    },
    {
      "id": 107957,
      "postDate": "2016-02-14T04:59:17.080Z",
      "content": "<p>[quote=happydemiologist;107931]</p>\n\n<p>Thank you, Rohan. I've learned a few new things from your solution. I'm just curious: why did you create your own function for creating dummy variables rather than using model.matrix?\n[/quote]\nIts just an old habit. Had written that function few years ago when I wasn't aware of model.matrix. Just used to it and a bit lazy to change :-)</p>",
      "rawMarkdown": "[quote=happydemiologist;107931]\r\n\r\nThank you, Rohan. I've learned a few new things from your solution. I'm just curious: why did you create your own function for creating dummy variables rather than using model.matrix?\r\n[/quote]\r\nIts just an old habit. Had written that function few years ago when I wasn't aware of model.matrix. Just used to it and a bit lazy to change :-)",
      "votes": 1
    },
    {
      "id": 107933,
      "postDate": "2016-02-13T23:30:02.817Z",
      "content": "<p>@Rohan Rao, Thank you for sharing, such a great opportunity to learn from you!</p>\n\n<p>Meanwhile I have following questions regarding your script:</p>\n\n<p>1,  Why did you do  X_test$country_destination &lt;- &quot;NDF&quot; ? Is is just because safer to be 'NDF' ?</p>\n\n<p>2,  I don't really understand what is the purpose of making 'sessions$count &lt;- 1' ? </p>\n\n<p>3,  When you '# merging some similar events into a single one', why did you divide by 10 after adding variables ?</p>\n\n<p>Really appreciate for your sharing and help !!</p>",
      "rawMarkdown": "@Rohan Rao, Thank you for sharing, such a great opportunity to learn from you!\r\n\r\nMeanwhile I have following questions regarding your script:\r\n\r\n1,  Why did you do  X_test$country_destination <- \"NDF\" ? Is is just because safer to be 'NDF' ?\r\n\r\n2,  I don't really understand what is the purpose of making 'sessions$count <- 1' ? \r\n\r\n3,  When you '# merging some similar events into a single one', why did you divide by 10 after adding variables ?\r\n\r\nReally appreciate for your sharing and help !!",
      "votes": 1
    },
    {
      "id": 107920,
      "postDate": "2016-02-13T19:25:50.147Z",
      "content": "<p>@ Rohan: It is a good idea to first classify NDF vs non-NDF. Thanks for sharing!</p>",
      "rawMarkdown": "@ Rohan: It is a good idea to first classify NDF vs non-NDF. Thanks for sharing!",
      "votes": 1
    },
    {
      "id": 107961,
      "postDate": "2016-02-14T05:34:47.957Z",
      "content": "<p>@Rohan Rao\nThank you for your answer =) \nWill dig deeper to understand your point! ^_^</p>",
      "rawMarkdown": "@Rohan Rao\r\nThank you for your answer =) \r\nWill dig deeper to understand your point! ^_^"
    },
    {
      "id": 107959,
      "postDate": "2016-02-14T05:08:29.450Z",
      "content": "<p>[quote=W. Yifan;107933]</p>\n\n<p>@Rohan Rao, Thank you for sharing, such a great opportunity to learn from you!</p>\n\n<p>Meanwhile I have following questions regarding your script:</p>\n\n<p>1,  Why did you do  X_test$country_destination &lt;- &quot;NDF&quot; ? Is is just because safer to be 'NDF' ?</p>\n\n<p>2,  I don't really understand what is the purpose of making 'sessions$count &lt;- 1' ? </p>\n\n<p>3,  When you '# merging some similar events into a single one', why did you divide by 10 after adding variables ?</p>\n\n<p>Really appreciate for your sharing and help !!\n[/quote]</p>\n\n<p>1) Its just a dummy value so that train and test have equal number of columns and its easier to rbind. You can set it as X_test$country_destination &lt;- &quot;Yifan&quot; and the code will still run fine :-)</p>\n\n<p>2) Again, just a dummy value due to the way dcast works. I'm sure there are cleaner ways of dummifying the action variables, I didn't optimize the code since it doesn't take long to run.</p>\n\n<p>3) Ohhh yes, thats a stupid thing. I wasn't able to code 'max' :-|\nBasically, what I wanted to do is take the maximum value of all those variables... so adding, dividing-by-10 and taking ceiling is a hackish version of 'max', and works only since all values are 0 and 1.</p>\n\n<p>You can divide by any number larger than the number of variables... like replacing 10 by 100 or 999.</p>\n\n<p>Maybe someone can help me figuring out how to take max of multiple variables?</p>",
      "rawMarkdown": "[quote=W. Yifan;107933]\r\n\r\n@Rohan Rao, Thank you for sharing, such a great opportunity to learn from you!\r\n\r\nMeanwhile I have following questions regarding your script:\r\n\r\n1,  Why did you do  X_test$country_destination <- \"NDF\" ? Is is just because safer to be 'NDF' ?\r\n\r\n2,  I don't really understand what is the purpose of making 'sessions$count <- 1' ? \r\n\r\n3,  When you '# merging some similar events into a single one', why did you divide by 10 after adding variables ?\r\n\r\nReally appreciate for your sharing and help !!\r\n[/quote]\r\n\r\n 1) Its just a dummy value so that train and test have equal number of columns and its easier to rbind. You can set it as X_test$country_destination <- \"Yifan\" and the code will still run fine :-)\r\n\r\n 2) Again, just a dummy value due to the way dcast works. I'm sure there are cleaner ways of dummifying the action variables, I didn't optimize the code since it doesn't take long to run.\r\n\r\n 3) Ohhh yes, thats a stupid thing. I wasn't able to code 'max' :-|\r\nBasically, what I wanted to do is take the maximum value of all those variables... so adding, dividing-by-10 and taking ceiling is a hackish version of 'max', and works only since all values are 0 and 1.\r\n\r\nYou can divide by any number larger than the number of variables... like replacing 10 by 100 or 999.\r\n\r\nMaybe someone can help me figuring out how to take max of multiple variables?"
    },
    {
      "id": 107931,
      "postDate": "2016-02-13T22:04:34.983Z",
      "content": "<p>Thank you, Rohan. I've learned a few new things from your solution. I'm just curious: why did you create your own function for creating dummy variables rather than using model.matrix?</p>",
      "rawMarkdown": "Thank you, Rohan. I've learned a few new things from your solution. I'm just curious: why did you create your own function for creating dummy variables rather than using model.matrix?\r\n"
    },
    {
      "id": 107910,
      "postDate": "2016-02-13T18:44:05.193Z",
      "rawMarkdown": "",
      "votes": 1,
      "isDeleted": true
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T13:52:40Z",
  "competition_id": 4651,
  "competition_slug": "airbnb-recruiting-new-user-bookings",
  "team_id": 243269,
  "solution_url": "/competitions/airbnb-recruiting-new-user-bookings/writeups/vopani-sharing-solution-of-rank-23-0-88625-on-priv"
}