{
  "id": 23633,
  "title": "A quick summary of Team Mystic (3rd place) solution",
  "url": "/competitions/grupo-bimbo-inventory-demand/writeups/team-mystic-a-quick-summary-of-team-mystic-3rd-pla",
  "author_name": "",
  "post_date": "2016-09-14T02:16:10.643Z",
  "votes": 17,
  "comment_count": 9,
  "views": 1352,
  "content": "<p>We use data from week 3 - 6 to generate features for week 7, and week 3 - 7 to generate features for week 8 - 9, and then train on week 7 to predict on week 8, and 9. Similarly, we use data from week 3 - 8 to generate features for week 9, and then train xgboost on week 9 to predict week 10 &amp; 11.</p>\n\n<p>We have two parts of features:</p>\n\n<ol>\n<li><p>Shallow features. We calculate max, min, median, mean, and standard deviation of demand on interactions of features. We also include features (Venta_uni_hoy, Venta_hoy, Dev_uni_proxima, Dev_proxima, Demanda_uni_equil) of the last 3 weeks.</p></li>\n<li><p>Deep features.  We train a dozen of linear models to get &quot;deep&quot; interaction signal between features. Vowpal wabbit, FTRL implemented with Pypy, libFM, and libFFM are all used to generate deep features.</p></li>\n</ol>\n\n<p>Combine these two parts, one single xgboost model is good enough to get the score we have in the public LB.</p>\n\n<p>Please comment if you have any questions. And code with detailed doc will be linked here after we get the final approval from kaggle and grupo bimbo. :)</p>",
  "messages": [
    {
      "id": "135430",
      "postDate": "09/14/2016 02:16:10",
      "content": "<p>We use data from week 3 - 6 to generate features for week 7, and week 3 - 7 to generate features for week 8 - 9, and then train on week 7 to predict on week 8, and 9. Similarly, we use data from week 3 - 8 to generate features for week 9, and then train xgboost on week 9 to predict week 10 &amp; 11.</p>\n\n<p>We have two parts of features:</p>\n\n<ol>\n<li><p>Shallow features. We calculate max, min, median, mean, and standard deviation of demand on interactions of features. We also include features (Venta_uni_hoy, Venta_hoy, Dev_uni_proxima, Dev_proxima, Demanda_uni_equil) of the last 3 weeks.</p></li>\n<li><p>Deep features.  We train a dozen of linear models to get &quot;deep&quot; interaction signal between features. Vowpal wabbit, FTRL implemented with Pypy, libFM, and libFFM are all used to generate deep features.</p></li>\n</ol>\n\n<p>Combine these two parts, one single xgboost model is good enough to get the score we have in the public LB.</p>\n\n<p>Please comment if you have any questions. And code with detailed doc will be linked here after we get the final approval from kaggle and grupo bimbo. :)</p>",
      "rawMarkdown": "We use data from week 3 - 6 to generate features for week 7, and week 3 - 7 to generate features for week 8 - 9, and then train on week 7 to predict on week 8, and 9. Similarly, we use data from week 3 - 8 to generate features for week 9, and then train xgboost on week 9 to predict week 10 & 11.\r\n\r\nWe have two parts of features:\r\n\r\n1.  Shallow features. We calculate max, min, median, mean, and standard deviation of demand on interactions of features. We also include features (Venta_uni_hoy, Venta_hoy, Dev_uni_proxima, Dev_proxima, Demanda_uni_equil) of the last 3 weeks.\r\n\r\n2.  Deep features.  We train a dozen of linear models to get \"deep\" interaction signal between features. Vowpal wabbit, FTRL implemented with Pypy, libFM, and libFFM are all used to generate deep features.\r\n\r\nCombine these two parts, one single xgboost model is good enough to get the score we have in the public LB.\r\n\r\nPlease comment if you have any questions. And code with detailed doc will be linked here after we get the final approval from kaggle and grupo bimbo. :)",
      "votes": null
    },
    {
      "id": "135445",
      "postDate": "09/14/2016 06:26:48",
      "content": "<p>Hi, my training runs took so very long that once I realized that there were gains to be made to make predictions using previous predictions, I gave up on trying because it would take too much time. It would be interesting to know how effective that actually was.</p>\n\n<p>Re 1) I was using shallow features similar to your implementation, but I didn't use max/min/std dev, that's a nice trick that I'll use in the future.</p>\n\n<p>Re 2) What features did you use for this?</p>\n\n<p>Thanks for sharing!</p>\n\n<p>/m</p>",
      "rawMarkdown": "Hi, my training runs took so very long that once I realized that there were gains to be made to make predictions using previous predictions, I gave up on trying because it would take too much time. It would be interesting to know how effective that actually was.\r\n\r\nRe 1) I was using shallow features similar to your implementation, but I didn't use max/min/std dev, that's a nice trick that I'll use in the future.\r\n\r\nRe 2) What features did you use for this?\r\n\r\nThanks for sharing!\r\n\r\n/m",
      "votes": null
    },
    {
      "id": "135447",
      "postDate": "09/14/2016 07:11:33",
      "content": "<p>I tried to combine some of the shallow features you mentioned with libFM using xgboost but my CV scores always got worse than libFM alone. Could you share the parameters of your xgboost model and how important the shallow features are? Thanks!</p>",
      "rawMarkdown": "I tried to combine some of the shallow features you mentioned with libFM using xgboost but my CV scores always got worse than libFM alone. Could you share the parameters of your xgboost model and how important the shallow features are? Thanks!",
      "votes": null
    },
    {
      "id": "135496",
      "postDate": "09/14/2016 15:04:59",
      "content": "<p>[quote=Mattias Fagerlund;135445]</p>\n\n<p>Hi, my training runs took so very long that once I realized that there were gains to be made to make predictions using previous predictions, I gave up on trying because it would take too much time. It would be interesting to know how effective that actually was.</p>\n\n<p>Re 1) I was using shallow features similar to your implementation, but I didn't use max/min/std dev, that's a nice trick that I'll use in the future.</p>\n\n<p>Re 2) What features did you use for this?</p>\n\n<p>Thanks for sharing!</p>\n\n<p>/m</p>\n\n<p>[/quote]</p>\n\n<p>Just the predicted result from those linear models. They actually didn't take much time to generate but were the most important features.</p>",
      "rawMarkdown": "[quote=Mattias Fagerlund;135445]\r\n\r\nHi, my training runs took so very long that once I realized that there were gains to be made to make predictions using previous predictions, I gave up on trying because it would take too much time. It would be interesting to know how effective that actually was.\r\n\r\nRe 1) I was using shallow features similar to your implementation, but I didn't use max/min/std dev, that's a nice trick that I'll use in the future.\r\n\r\nRe 2) What features did you use for this?\r\n\r\nThanks for sharing!\r\n\r\n/m\r\n\r\n[/quote]\r\n\r\nJust the predicted result from those linear models. They actually didn't take much time to generate but were the most important features.",
      "votes": null
    },
    {
      "id": "135497",
      "postDate": "09/14/2016 15:05:57",
      "content": "<p>[quote=Sangxia;135447]</p>\n\n<p>I tried to combine some of the shallow features you mentioned with libFM using xgboost but my CV scores always got worse than libFM alone. Could you share the parameters of your xgboost model and how important the shallow features are? Thanks!</p>\n\n<p>[/quote]</p>\n\n<p>Were you doing the same validation as we did? If that is the case, it seemed to improve our score with any libFM models and we didn't have to tune xgboost at all to get better scores.</p>",
      "rawMarkdown": "[quote=Sangxia;135447]\r\n\r\nI tried to combine some of the shallow features you mentioned with libFM using xgboost but my CV scores always got worse than libFM alone. Could you share the parameters of your xgboost model and how important the shallow features are? Thanks!\r\n\r\n[/quote]\r\n\r\nWere you doing the same validation as we did? If that is the case, it seemed to improve our score with any libFM models and we didn't have to tune xgboost at all to get better scores.",
      "votes": null
    },
    {
      "id": "135506",
      "postDate": "09/14/2016 16:22:38",
      "content": "<p>Thank you for an exceptionally concise write-up.  </p>",
      "rawMarkdown": "Thank you for an exceptionally concise write-up.",
      "votes": null
    },
    {
      "id": "135517",
      "postDate": "09/14/2016 17:02:57",
      "content": "<p>@Little Boat</p>\n\n<p>Please, forgive my &quot;naiveness&quot; but can you please help me understand your point (2), aka,  Deep Features?\nI would like to understand the theory behind it and how you did it. Because obviously these deep features was the reason of your success.</p>\n\n<p>Thank you in advanced for the teaching ;)</p>",
      "rawMarkdown": "Little Boat\r\n\r\nPlease, forgive my \"naiveness\" but can you please help me understand your point (2), aka,  Deep Features?\r\nI would like to understand the theory behind it and how you did it. Because obviously these deep features was the reason of your success.\r\n\r\nThank you in advanced for the teaching ;)",
      "votes": null
    },
    {
      "id": "135589",
      "postDate": "09/15/2016 04:50:16",
      "content": "<p>[quote=PabloMarin;135517]</p>\n\n<p>@Little Boat</p>\n\n<p>Please, forgive my &quot;naiveness&quot; but can you please help me understand your point (2), aka,  Deep Features?\nI would like to understand the theory behind it and how you did it. Because obviously these deep features was the reason of your success.</p>\n\n<p>Thank you in advanced for the teaching ;)</p>\n\n<p>[/quote]</p>\n\n<p>Briefly, you can think of the shallow features as simple descriptive statistics while the deep features are linear interaction between all features.  Shallow features describe the rough &quot;shape&quot; of those interactions, for example, for the same pair of product and client, they will all have the same values, while deep features model all interactions and give predictions based on all features. You can think shallow feature as &quot;big picture&quot; while deep features are &quot;detail oriented&quot;.</p>",
      "rawMarkdown": "[quote=PabloMarin;135517]\r\n\r\n@Little Boat\r\n\r\nPlease, forgive my \"naiveness\" but can you please help me understand your point (2), aka,  Deep Features?\r\nI would like to understand the theory behind it and how you did it. Because obviously these deep features was the reason of your success.\r\n\r\nThank you in advanced for the teaching ;)\r\n\r\n[/quote]\r\n\r\nBriefly, you can think of the shallow features as simple descriptive statistics while the deep features are linear interaction between all features.  Shallow features describe the rough \"shape\" of those interactions, for example, for the same pair of product and client, they will all have the same values, while deep features model all interactions and give predictions based on all features. You can think shallow feature as \"big picture\" while deep features are \"detail oriented\".",
      "votes": null
    },
    {
      "id": "136077",
      "postDate": "09/19/2016 22:49:22",
      "content": "<p>@Little Boat, thank you very much for sharing, appreciate it! Congratulations. </p>\n\n<p>I can understand LibFM to be used in here, but for field-aware LibFFM = I'm confused how to build the data set ;) </p>\n\n<blockquote>\n  <p><em>And code with detailed doc will be linked here after we get the final approval from kaggle and grupo bimbo</em>. :)</p>\n</blockquote>\n\n<p>Hopefully.. I really want to learn LibFFM. Thank you in advance. (+100 if I can). </p>",
      "rawMarkdown": "Little Boat, thank you very much for sharing, appreciate it! Congratulations. \r\n\r\nI can understand LibFM to be used in here, but for field-aware LibFFM = I'm confused how to build the data set ;) \r\n\r\n>   *And code with detailed doc will be linked here after we get the final approval from kaggle and grupo bimbo*. :)\r\n\r\nHopefully.. I really want to learn LibFFM. Thank you in advance. (+100 if I can).",
      "votes": null
    },
    {
      "id": "136326",
      "postDate": "09/21/2016 10:07:35",
      "content": "<p>Thanks a lot for sharing.</p>\n\n<p>I went somewhat same way as you, but only used one linear model (vw) and the gain wasn't really significant.  I'll try harder next time!</p>",
      "rawMarkdown": "Thanks a lot for sharing.\r\n\r\nI went somewhat same way as you, but only used one linear model (vw) and the gain wasn't really significant.  I'll try harder next time!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 135445,
      "author_name": "mfagerlund",
      "author_url": "",
      "post_date": "09/14/2016 06:26:48",
      "content": "<p>Hi, my training runs took so very long that once I realized that there were gains to be made to make predictions using previous predictions, I gave up on trying because it would take too much time. It would be interesting to know how effective that actually was.</p>\n\n<p>Re 1) I was using shallow features similar to your implementation, but I didn't use max/min/std dev, that's a nice trick that I'll use in the future.</p>\n\n<p>Re 2) What features did you use for this?</p>\n\n<p>Thanks for sharing!</p>\n\n<p>/m</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 135447,
      "author_name": "sangxia",
      "author_url": "",
      "post_date": "09/14/2016 07:11:33",
      "content": "<p>I tried to combine some of the shallow features you mentioned with libFM using xgboost but my CV scores always got worse than libFM alone. Could you share the parameters of your xgboost model and how important the shallow features are? Thanks!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 135496,
      "author_name": "xiaozhouwang",
      "author_url": "",
      "post_date": "09/14/2016 15:04:59",
      "content": "<p>[quote=Mattias Fagerlund;135445]</p>\n\n<p>Hi, my training runs took so very long that once I realized that there were gains to be made to make predictions using previous predictions, I gave up on trying because it would take too much time. It would be interesting to know how effective that actually was.</p>\n\n<p>Re 1) I was using shallow features similar to your implementation, but I didn't use max/min/std dev, that's a nice trick that I'll use in the future.</p>\n\n<p>Re 2) What features did you use for this?</p>\n\n<p>Thanks for sharing!</p>\n\n<p>/m</p>\n\n<p>[/quote]</p>\n\n<p>Just the predicted result from those linear models. They actually didn't take much time to generate but were the most important features.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 135497,
      "author_name": "xiaozhouwang",
      "author_url": "",
      "post_date": "09/14/2016 15:05:57",
      "content": "<p>[quote=Sangxia;135447]</p>\n\n<p>I tried to combine some of the shallow features you mentioned with libFM using xgboost but my CV scores always got worse than libFM alone. Could you share the parameters of your xgboost model and how important the shallow features are? Thanks!</p>\n\n<p>[/quote]</p>\n\n<p>Were you doing the same validation as we did? If that is the case, it seemed to improve our score with any libFM models and we didn't have to tune xgboost at all to get better scores.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 135506,
      "author_name": "wpanak",
      "author_url": "",
      "post_date": "09/14/2016 16:22:38",
      "content": "<p>Thank you for an exceptionally concise write-up.  </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 135517,
      "author_name": "pablomarin",
      "author_url": "",
      "post_date": "09/14/2016 17:02:57",
      "content": "<p>@Little Boat</p>\n\n<p>Please, forgive my &quot;naiveness&quot; but can you please help me understand your point (2), aka,  Deep Features?\nI would like to understand the theory behind it and how you did it. Because obviously these deep features was the reason of your success.</p>\n\n<p>Thank you in advanced for the teaching ;)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 135589,
      "author_name": "xiaozhouwang",
      "author_url": "",
      "post_date": "09/15/2016 04:50:16",
      "content": "<p>[quote=PabloMarin;135517]</p>\n\n<p>@Little Boat</p>\n\n<p>Please, forgive my &quot;naiveness&quot; but can you please help me understand your point (2), aka,  Deep Features?\nI would like to understand the theory behind it and how you did it. Because obviously these deep features was the reason of your success.</p>\n\n<p>Thank you in advanced for the teaching ;)</p>\n\n<p>[/quote]</p>\n\n<p>Briefly, you can think of the shallow features as simple descriptive statistics while the deep features are linear interaction between all features.  Shallow features describe the rough &quot;shape&quot; of those interactions, for example, for the same pair of product and client, they will all have the same values, while deep features model all interactions and give predictions based on all features. You can think shallow feature as &quot;big picture&quot; while deep features are &quot;detail oriented&quot;.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 136077,
      "author_name": "aldente",
      "author_url": "",
      "post_date": "09/19/2016 22:49:22",
      "content": "<p>@Little Boat, thank you very much for sharing, appreciate it! Congratulations. </p>\n\n<p>I can understand LibFM to be used in here, but for field-aware LibFFM = I'm confused how to build the data set ;) </p>\n\n<blockquote>\n  <p><em>And code with detailed doc will be linked here after we get the final approval from kaggle and grupo bimbo</em>. :)</p>\n</blockquote>\n\n<p>Hopefully.. I really want to learn LibFFM. Thank you in advance. (+100 if I can). </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 136326,
      "author_name": "cpmpml",
      "author_url": "",
      "post_date": "09/21/2016 10:07:35",
      "content": "<p>Thanks a lot for sharing.</p>\n\n<p>I went somewhat same way as you, but only used one linear model (vw) and the gain wasn't really significant.  I'll try harder next time!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "135430": "We use data from week 3 - 6 to generate features for week 7, and week 3 - 7 to generate features for week 8 - 9, and then train on week 7 to predict on week 8, and 9. Similarly, we use data from week 3 - 8 to generate features for week 9, and then train xgboost on week 9 to predict week 10 & 11.\r\n\r\nWe have two parts of features:\r\n\r\n1.  Shallow features. We calculate max, min, median, mean, and standard deviation of demand on interactions of features. We also include features (Venta_uni_hoy, Venta_hoy, Dev_uni_proxima, Dev_proxima, Demanda_uni_equil) of the last 3 weeks.\r\n\r\n2.  Deep features.  We train a dozen of linear models to get \"deep\" interaction signal between features. Vowpal wabbit, FTRL implemented with Pypy, libFM, and libFFM are all used to generate deep features.\r\n\r\nCombine these two parts, one single xgboost model is good enough to get the score we have in the public LB.\r\n\r\nPlease comment if you have any questions. And code with detailed doc will be linked here after we get the final approval from kaggle and grupo bimbo. :)",
    "135445": "Hi, my training runs took so very long that once I realized that there were gains to be made to make predictions using previous predictions, I gave up on trying because it would take too much time. It would be interesting to know how effective that actually was.\r\n\r\nRe 1) I was using shallow features similar to your implementation, but I didn't use max/min/std dev, that's a nice trick that I'll use in the future.\r\n\r\nRe 2) What features did you use for this?\r\n\r\nThanks for sharing!\r\n\r\n/m",
    "135447": "I tried to combine some of the shallow features you mentioned with libFM using xgboost but my CV scores always got worse than libFM alone. Could you share the parameters of your xgboost model and how important the shallow features are? Thanks!",
    "135496": "[quote=Mattias Fagerlund;135445]\r\n\r\nHi, my training runs took so very long that once I realized that there were gains to be made to make predictions using previous predictions, I gave up on trying because it would take too much time. It would be interesting to know how effective that actually was.\r\n\r\nRe 1) I was using shallow features similar to your implementation, but I didn't use max/min/std dev, that's a nice trick that I'll use in the future.\r\n\r\nRe 2) What features did you use for this?\r\n\r\nThanks for sharing!\r\n\r\n/m\r\n\r\n[/quote]\r\n\r\nJust the predicted result from those linear models. They actually didn't take much time to generate but were the most important features.",
    "135497": "[quote=Sangxia;135447]\r\n\r\nI tried to combine some of the shallow features you mentioned with libFM using xgboost but my CV scores always got worse than libFM alone. Could you share the parameters of your xgboost model and how important the shallow features are? Thanks!\r\n\r\n[/quote]\r\n\r\nWere you doing the same validation as we did? If that is the case, it seemed to improve our score with any libFM models and we didn't have to tune xgboost at all to get better scores.",
    "135506": "Thank you for an exceptionally concise write-up.",
    "135517": "Little Boat\r\n\r\nPlease, forgive my \"naiveness\" but can you please help me understand your point (2), aka,  Deep Features?\r\nI would like to understand the theory behind it and how you did it. Because obviously these deep features was the reason of your success.\r\n\r\nThank you in advanced for the teaching ;)",
    "135589": "[quote=PabloMarin;135517]\r\n\r\n@Little Boat\r\n\r\nPlease, forgive my \"naiveness\" but can you please help me understand your point (2), aka,  Deep Features?\r\nI would like to understand the theory behind it and how you did it. Because obviously these deep features was the reason of your success.\r\n\r\nThank you in advanced for the teaching ;)\r\n\r\n[/quote]\r\n\r\nBriefly, you can think of the shallow features as simple descriptive statistics while the deep features are linear interaction between all features.  Shallow features describe the rough \"shape\" of those interactions, for example, for the same pair of product and client, they will all have the same values, while deep features model all interactions and give predictions based on all features. You can think shallow feature as \"big picture\" while deep features are \"detail oriented\".",
    "136077": "Little Boat, thank you very much for sharing, appreciate it! Congratulations. \r\n\r\nI can understand LibFM to be used in here, but for field-aware LibFFM = I'm confused how to build the data set ;) \r\n\r\n>   *And code with detailed doc will be linked here after we get the final approval from kaggle and grupo bimbo*. :)\r\n\r\nHopefully.. I really want to learn LibFFM. Thank you in advance. (+100 if I can).",
    "136326": "Thanks a lot for sharing.\r\n\r\nI went somewhat same way as you, but only used one linear model (vw) and the gain wasn't really significant.  I'll try harder next time!"
  },
  "source": "existing_discussion",
  "complete": true,
  "competition_id": 5260,
  "competition_slug": "grupo-bimbo-inventory-demand",
  "team_id": 341928,
  "solution_url": "/competitions/grupo-bimbo-inventory-demand/writeups/team-mystic-a-quick-summary-of-team-mystic-3rd-pla"
}