{
  "id": 122796,
  "title": "[497th place shake down solution] PUBLIC LB 1st place solution",
  "url": "/competitions/ashrae-energy-prediction/writeups/hiroyuki-namba-497th-place-shake-down-solution-pub",
  "author_name": "",
  "post_date": "2019-12-28T01:28:55.170Z",
  "votes": 104,
  "comment_count": 19,
  "views": 0,
  "content": "<p>Since we can “feel free to post solutions and write-ups” now according to <a href=\"https://www.kaggle.com/c/ashrae-energy-prediction/discussion/122296\">https://www.kaggle.com/c/ashrae-energy-prediction/discussion/122296</a>\nI summarize my solution.</p>\n\n<p>I appreciate ASHRAE and Kaggle for this really interesting competition. In spite of some terrible leakage, this competition is not destroyed thanks to sincere kagglers and rational rules clarification by organizers.</p>\n\n<p>[Feature Engineering and Feature Selection]\n-Final model used only 18 features.\n-I tried a lot of features but many were not useful.\n-Though dew temperature has high feature importance, I removed dew temperature because CV was better without it. I think air temperature is more important and dew temperature harms the contribution of air temperature.\n-Categorical Multiplication had a slight positive impact. For example site_id_and_meter.</p>\n\n<p>[Validation Strategy]\n-Mainly based on [1-6] train [7-12] valid. [1-6] means January to June.\n-Also watched [7-12] train [1-6] valid, and [1-9] train [10-12] valid.\n-After leakage, I also validated by site0,1,2,15.</p>\n\n<p>[Outlier Removal]\n-The most important part.\n-I plotted and watched all time-series carefully, and extracted so many rules that may detect outlier. I evaluated over 100 rules by the above Validation Strategy one by one.\n-Examples of effective rules: “Meter 0 and long 0 segment”/”Meter 2 and start before April and long 0 segment”/”0 segments in many building at the same time”/”day average is too small in January comparing with December”.</p>\n\n<p>[Single Model]\n-Only LGBM.\n-I tried CatBoost/time-series based methods but not worked.\n-Tuned Parameters: num_leaves=127, feature_fraction=0.6.</p>\n\n<p>[Ensemble]\n-Totally 32 LGBM models.\n-4 random seed averages for each model.\n-[1-6] train model and [7-12] train model, similar to half-and-half kernel.\n-Optimized weights for each model (Important).\n--Basically, weight for [7-12] model was set higher than weight for [1-6], since [7-12] model was created from recent data.\n--Furthermore, weight for [7-12] model was set higher for test data from July to December.\n--Weight for [1-6] model was set higher for test data whose time-series has few train data (due to outliers) in [7-12].</p>\n\n<p>[PostProcess]\n-Plotted all time-series before submission and extracted some effective postprocess rules that may improve LB score.\n--Modified to smaller value by applying piecewise linear function f. For example, 9.8 before log1p is modified to f(9.8)≒9.7. I searched optimal f and LB improved around 0.002. I think it is effective because there is some “unpredictable 0” but there is few “unpredictable large value“ (Important).\n--Clipped to [0.1, 10.5] before log1p.</p>\n\n<p>[Leak]\n-Replaced leaked label just before submission (site0,1,2,15 and part of site4)\n-Used for validation (site0,1,2,15)\n-No other external data, no leaked data in training data, no other methods to exploit leakage.</p>\n\n<p>Thank you for all comments! I will try to reply all questions within 24-48 business hours.</p>",
  "messages": [
    {
      "id": "700994",
      "postDate": "12/23/2019 00:18:10",
      "content": "<p>Since we can “feel free to post solutions and write-ups” now according to <a href=\"https://www.kaggle.com/c/ashrae-energy-prediction/discussion/122296\">https://www.kaggle.com/c/ashrae-energy-prediction/discussion/122296</a>\nI summarize my solution.</p>\n\n<p>I appreciate ASHRAE and Kaggle for this really interesting competition. In spite of some terrible leakage, this competition is not destroyed thanks to sincere kagglers and rational rules clarification by organizers.</p>\n\n<p>[Feature Engineering and Feature Selection]\n-Final model used only 18 features.\n-I tried a lot of features but many were not useful.\n-Though dew temperature has high feature importance, I removed dew temperature because CV was better without it. I think air temperature is more important and dew temperature harms the contribution of air temperature.\n-Categorical Multiplication had a slight positive impact. For example site_id_and_meter.</p>\n\n<p>[Validation Strategy]\n-Mainly based on [1-6] train [7-12] valid. [1-6] means January to June.\n-Also watched [7-12] train [1-6] valid, and [1-9] train [10-12] valid.\n-After leakage, I also validated by site0,1,2,15.</p>\n\n<p>[Outlier Removal]\n-The most important part.\n-I plotted and watched all time-series carefully, and extracted so many rules that may detect outlier. I evaluated over 100 rules by the above Validation Strategy one by one.\n-Examples of effective rules: “Meter 0 and long 0 segment”/”Meter 2 and start before April and long 0 segment”/”0 segments in many building at the same time”/”day average is too small in January comparing with December”.</p>\n\n<p>[Single Model]\n-Only LGBM.\n-I tried CatBoost/time-series based methods but not worked.\n-Tuned Parameters: num_leaves=127, feature_fraction=0.6.</p>\n\n<p>[Ensemble]\n-Totally 32 LGBM models.\n-4 random seed averages for each model.\n-[1-6] train model and [7-12] train model, similar to half-and-half kernel.\n-Optimized weights for each model (Important).\n--Basically, weight for [7-12] model was set higher than weight for [1-6], since [7-12] model was created from recent data.\n--Furthermore, weight for [7-12] model was set higher for test data from July to December.\n--Weight for [1-6] model was set higher for test data whose time-series has few train data (due to outliers) in [7-12].</p>\n\n<p>[PostProcess]\n-Plotted all time-series before submission and extracted some effective postprocess rules that may improve LB score.\n--Modified to smaller value by applying piecewise linear function f. For example, 9.8 before log1p is modified to f(9.8)≒9.7. I searched optimal f and LB improved around 0.002. I think it is effective because there is some “unpredictable 0” but there is few “unpredictable large value“ (Important).\n--Clipped to [0.1, 10.5] before log1p.</p>\n\n<p>[Leak]\n-Replaced leaked label just before submission (site0,1,2,15 and part of site4)\n-Used for validation (site0,1,2,15)\n-No other external data, no leaked data in training data, no other methods to exploit leakage.</p>\n\n<p>Thank you for all comments! I will try to reply all questions within 24-48 business hours.</p>",
      "rawMarkdown": "Since we can “feel free to post solutions and write-ups” now according to https://www.kaggle.com/c/ashrae-energy-prediction/discussion/122296\nI summarize my solution.\n\nI appreciate ASHRAE and Kaggle for this really interesting competition. In spite of some terrible leakage, this competition is not destroyed thanks to sincere kagglers and rational rules clarification by organizers.\n\n[Feature Engineering and Feature Selection]\n-Final model used only 18 features.\n-I tried a lot of features but many were not useful.\n-Though dew temperature has high feature importance, I removed dew temperature because CV was better without it. I think air temperature is more important and dew temperature harms the contribution of air temperature.\n-Categorical Multiplication had a slight positive impact. For example site_id_and_meter.\n\n[Validation Strategy]\n-Mainly based on [1-6] train [7-12] valid. [1-6] means January to June.\n-Also watched [7-12] train [1-6] valid, and [1-9] train [10-12] valid.\n-After leakage, I also validated by site0,1,2,15.\n\n[Outlier Removal]\n-The most important part.\n-I plotted and watched all time-series carefully, and extracted so many rules that may detect outlier. I evaluated over 100 rules by the above Validation Strategy one by one.\n-Examples of effective rules: “Meter 0 and long 0 segment”/”Meter 2 and start before April and long 0 segment”/”0 segments in many building at the same time”/”day average is too small in January comparing with December”.\n\n[Single Model]\n-Only LGBM.\n-I tried CatBoost/time-series based methods but not worked.\n-Tuned Parameters: num_leaves=127, feature_fraction=0.6.\n\n[Ensemble]\n-Totally 32 LGBM models.\n-4 random seed averages for each model.\n-[1-6] train model and [7-12] train model, similar to half-and-half kernel.\n-Optimized weights for each model (Important).\n--Basically, weight for [7-12] model was set higher than weight for [1-6], since [7-12] model was created from recent data.\n--Furthermore, weight for [7-12] model was set higher for test data from July to December.\n--Weight for [1-6] model was set higher for test data whose time-series has few train data (due to outliers) in [7-12].\n\n[PostProcess]\n-Plotted all time-series before submission and extracted some effective postprocess rules that may improve LB score.\n--Modified to smaller value by applying piecewise linear function f. For example, 9.8 before log1p is modified to f(9.8)≒9.7. I searched optimal f and LB improved around 0.002. I think it is effective because there is some “unpredictable 0” but there is few “unpredictable large value“ (Important).\n--Clipped to [0.1, 10.5] before log1p.\n\n[Leak]\n-Replaced leaked label just before submission (site0,1,2,15 and part of site4)\n-Used for validation (site0,1,2,15)\n-No other external data, no leaked data in training data, no other methods to exploit leakage.\n\nThank you for all comments! I will try to reply all questions within 24-48 business hours.",
      "votes": null
    },
    {
      "id": "700997",
      "postDate": "12/23/2019 00:24:38",
      "content": "<p>great solution</p>",
      "rawMarkdown": "great solution",
      "votes": null
    },
    {
      "id": "701230",
      "postDate": "12/23/2019 09:08:21",
      "content": "<p>Great job. And how did you train the 32 LGBM ? What's the difference between each other ?</p>",
      "rawMarkdown": "Great job. And how did you train the 32 LGBM ? What's the difference between each other ?",
      "votes": null
    },
    {
      "id": "701362",
      "postDate": "12/23/2019 12:01:16",
      "content": "<p>2×4×2×2=32\n2 -&gt; [1-6] train model or [7-12] train model (important)\n4 -&gt; 4 random seed average (effective)\n2 -&gt; Remove all suspicious outlier or remove only obvious outlier (slightly effective)\n2 -&gt; Modify site0 electric units or not (almost no effects)</p>",
      "rawMarkdown": "2×4×2×2=32\n2 -&gt; [1-6] train model or [7-12] train model (important)\n4 -&gt; 4 random seed average (effective)\n2 -&gt; Remove all suspicious outlier or remove only obvious outlier (slightly effective)\n2 -&gt; Modify site0 electric units or not (almost no effects)",
      "votes": null
    },
    {
      "id": "701382",
      "postDate": "12/23/2019 12:26:49",
      "content": "<p>Great job! Mean and std value of air and dew temperature also worked in my best single model, and I found that spliting data into month groups performs better than just KFold.  However, I found that 6 groups is better than 4 and 2, while your best single model is 2 groups.  Look forward to your code part in notebook!! </p>",
      "rawMarkdown": "Great job! Mean and std value of air and dew temperature also worked in my best single model, and I found that spliting data into month groups performs better than just KFold.  However, I found that 6 groups is better than 4 and 2, while your best single model is 2 groups.  Look forward to your code part in notebook!!",
      "votes": null
    },
    {
      "id": "701496",
      "postDate": "12/23/2019 14:48:31",
      "content": "<p>Congrats! How did you combine the ensembles' outputs? Mean? Median? </p>",
      "rawMarkdown": "Congrats! How did you combine the ensembles' outputs? Mean? Median?",
      "votes": null
    },
    {
      "id": "701653",
      "postDate": "12/23/2019 18:17:26",
      "content": "<p>wonderful solution, thanks for sharing <a href=\"/hiroyukiex\">@hiroyukiex</a> , I would love to hear more for the outlier detection rules and those 32 lgbm models that you used for ensembling</p>",
      "rawMarkdown": "wonderful solution, thanks for sharing @hiroyukiex , I would love to hear more for the outlier detection rules and those 32 lgbm models that you used for ensembling",
      "votes": null
    },
    {
      "id": "701921",
      "postDate": "12/24/2019 03:48:19",
      "content": "<p>Thank you <a href=\"/hiroyukiex\">@hiroyukiex</a> for the solution.</p>",
      "rawMarkdown": "Thank you @hiroyukiex for the solution.",
      "votes": null
    },
    {
      "id": "702591",
      "postDate": "12/24/2019 22:03:03",
      "content": "<p>Thanks for sharing. Good luck with the final result.</p>",
      "rawMarkdown": "Thanks for sharing. Good luck with the final result.",
      "votes": null
    },
    {
      "id": "702636",
      "postDate": "12/25/2019 00:22:26",
      "content": "<p>8 predictions combined like the figure.\n-Simple mean in terms of 4 red predictions (multiply 1/4).\n-w is optimied (Please read [Ensemble] section in details)\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F995847%2F8a0c2ba6092e727a18426e27dab9bc86%2Fashrae_discussion1.PNG?generation=1577233464436233&amp;alt=media\" alt=\"\"></p>\n\n<p>In fact, each red prediction is created from 4 models, but almost no effects.\nI think only 8 models are enough rather than 32 to get near-optimal score.</p>",
      "rawMarkdown": "8 predictions combined like the figure.\n-Simple mean in terms of 4 red predictions (multiply 1/4).\n-w is optimied (Please read [Ensemble] section in details)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F995847%2F8a0c2ba6092e727a18426e27dab9bc86%2Fashrae_discussion1.PNG?generation=1577233464436233&amp;alt=media)\n\n\nIn fact, each red prediction is created from 4 models, but almost no effects.\nI think only 8 models are enough rather than 32 to get near-optimal score.",
      "votes": null
    },
    {
      "id": "702648",
      "postDate": "12/25/2019 00:59:34",
      "content": "<p>Most of my outlier rules are so complicated and difficult to tell strictly, but they are mainly based on \"constant-segment-info\" and \"day-mean\".</p>\n\n<p>[constant-segment-info]\n-To deal with constant outliers.\n-Extract (nearly) constant segments with segment features.\n-Examples of segment features are start_day, end_day, length, count_of_segments_in_the_time_series, count_of_long_segments_in_the_time_series, count_of_segments_with_same_start_day.</p>\n\n<p>[day-avg]\n-To deal with non-constant outliers.\n-day-avg stands for Groupby([\"building_id\",\"meter\",\"day\"])[\"meter_reading\"].mean()\n-Also used day-group-avg (group represents 15days interval)\n-day-group with definitely and weirdly small values are removed.</p>",
      "rawMarkdown": "Most of my outlier rules are so complicated and difficult to tell strictly, but they are mainly based on \"constant-segment-info\" and \"day-mean\".\n\n[constant-segment-info]\n-To deal with constant outliers.\n-Extract (nearly) constant segments with segment features.\n-Examples of segment features are start_day, end_day, length, count_of_segments_in_the_time_series, count_of_long_segments_in_the_time_series, count_of_segments_with_same_start_day.\n\n[day-avg]\n-To deal with non-constant outliers.\n-day-avg stands for Groupby([\"building_id\",\"meter\",\"day\"])[\"meter_reading\"].mean()\n-Also used day-group-avg (group represents 15days interval)\n-day-group with definitely and weirdly small values are removed.",
      "votes": null
    },
    {
      "id": "702684",
      "postDate": "12/25/2019 02:27:51",
      "content": "<p>thanks</p>",
      "rawMarkdown": "thanks",
      "votes": null
    },
    {
      "id": "702761",
      "postDate": "12/25/2019 05:42:08",
      "content": "<p>thanks <a href=\"/hiroyukiex\">@hiroyukiex</a> , I really think the outlier removal has made the huge difference, good luck</p>",
      "rawMarkdown": "thanks @hiroyukiex , I really think the outlier removal has made the huge difference, good luck",
      "votes": null
    },
    {
      "id": "702984",
      "postDate": "12/25/2019 12:44:49",
      "content": "<p>Got it! Nice approach! </p>",
      "rawMarkdown": "Got it! Nice approach!",
      "votes": null
    },
    {
      "id": "704098",
      "postDate": "12/27/2019 03:40:16",
      "content": "<p>Thanks for sharing your great solution, <a href=\"/hiroyukiex\">@hiroyukiex</a> \nI have been impressed by your work throughout this competiton 😄 </p>",
      "rawMarkdown": "Thanks for sharing your great solution, @hiroyukiex \nI have been impressed by your work throughout this competiton 😄",
      "votes": null
    },
    {
      "id": "704671",
      "postDate": "12/27/2019 20:06:49",
      "content": "<p>Thanks for sharing this.\nHow do you find the optimized weight for your ensemble?</p>",
      "rawMarkdown": "Thanks for sharing this.\nHow do you find the optimized weight for your ensemble?",
      "votes": null
    },
    {
      "id": "704729",
      "postDate": "12/27/2019 23:49:07",
      "content": "<p>Based on site0,1,2,15 leakage and public LB.</p>",
      "rawMarkdown": "Based on site0,1,2,15 leakage and public LB.",
      "votes": null
    },
    {
      "id": "704992",
      "postDate": "12/28/2019 09:03:10",
      "content": "<p>damn, what a crazy shake-up</p>",
      "rawMarkdown": "damn, what a crazy shake-up",
      "votes": null
    },
    {
      "id": "714068",
      "postDate": "01/09/2020 02:26:44",
      "content": "<p>sad</p>",
      "rawMarkdown": "sad",
      "votes": null
    },
    {
      "id": "761470",
      "postDate": "03/02/2020 14:54:20",
      "content": "<p>Just out of curosity, why would you use models with different seeds? How did you come up with this idea ? <a href=\"/hiroyukiex\">@hiroyukiex</a> </p>",
      "rawMarkdown": "Just out of curosity, why would you use models with different seeds? How did you come up with this idea ? @hiroyukiex",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 700997,
      "author_name": "laplaceplanet",
      "author_url": "",
      "post_date": "12/23/2019 00:24:38",
      "content": "<p>great solution</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 701230,
      "author_name": "vicioussong",
      "author_url": "",
      "post_date": "12/23/2019 09:08:21",
      "content": "<p>Great job. And how did you train the 32 LGBM ? What's the difference between each other ?</p>",
      "votes": null,
      "replies": [
        {
          "id": 701362,
          "author_name": "hiroyukiex",
          "author_url": "",
          "post_date": "12/23/2019 12:01:16",
          "content": "<p>2×4×2×2=32\n2 -&gt; [1-6] train model or [7-12] train model (important)\n4 -&gt; 4 random seed average (effective)\n2 -&gt; Remove all suspicious outlier or remove only obvious outlier (slightly effective)\n2 -&gt; Modify site0 electric units or not (almost no effects)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 701382,
      "author_name": "clancey",
      "author_url": "",
      "post_date": "12/23/2019 12:26:49",
      "content": "<p>Great job! Mean and std value of air and dew temperature also worked in my best single model, and I found that spliting data into month groups performs better than just KFold.  However, I found that 6 groups is better than 4 and 2, while your best single model is 2 groups.  Look forward to your code part in notebook!! </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 701496,
      "author_name": "wittmannf",
      "author_url": "",
      "post_date": "12/23/2019 14:48:31",
      "content": "<p>Congrats! How did you combine the ensembles' outputs? Mean? Median? </p>",
      "votes": null,
      "replies": [
        {
          "id": 702636,
          "author_name": "hiroyukiex",
          "author_url": "",
          "post_date": "12/25/2019 00:22:26",
          "content": "<p>8 predictions combined like the figure.\n-Simple mean in terms of 4 red predictions (multiply 1/4).\n-w is optimied (Please read [Ensemble] section in details)\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F995847%2F8a0c2ba6092e727a18426e27dab9bc86%2Fashrae_discussion1.PNG?generation=1577233464436233&amp;alt=media\" alt=\"\"></p>\n\n<p>In fact, each red prediction is created from 4 models, but almost no effects.\nI think only 8 models are enough rather than 32 to get near-optimal score.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 702984,
          "author_name": "wittmannf",
          "author_url": "",
          "post_date": "12/25/2019 12:44:49",
          "content": "<p>Got it! Nice approach! </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 701653,
      "author_name": "frtgnn",
      "author_url": "",
      "post_date": "12/23/2019 18:17:26",
      "content": "<p>wonderful solution, thanks for sharing <a href=\"/hiroyukiex\">@hiroyukiex</a> , I would love to hear more for the outlier detection rules and those 32 lgbm models that you used for ensembling</p>",
      "votes": null,
      "replies": [
        {
          "id": 702648,
          "author_name": "hiroyukiex",
          "author_url": "",
          "post_date": "12/25/2019 00:59:34",
          "content": "<p>Most of my outlier rules are so complicated and difficult to tell strictly, but they are mainly based on \"constant-segment-info\" and \"day-mean\".</p>\n\n<p>[constant-segment-info]\n-To deal with constant outliers.\n-Extract (nearly) constant segments with segment features.\n-Examples of segment features are start_day, end_day, length, count_of_segments_in_the_time_series, count_of_long_segments_in_the_time_series, count_of_segments_with_same_start_day.</p>\n\n<p>[day-avg]\n-To deal with non-constant outliers.\n-day-avg stands for Groupby([\"building_id\",\"meter\",\"day\"])[\"meter_reading\"].mean()\n-Also used day-group-avg (group represents 15days interval)\n-day-group with definitely and weirdly small values are removed.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 702761,
          "author_name": "frtgnn",
          "author_url": "",
          "post_date": "12/25/2019 05:42:08",
          "content": "<p>thanks <a href=\"/hiroyukiex\">@hiroyukiex</a> , I really think the outlier removal has made the huge difference, good luck</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 701921,
      "author_name": "sabinhashmi",
      "author_url": "",
      "post_date": "12/24/2019 03:48:19",
      "content": "<p>Thank you <a href=\"/hiroyukiex\">@hiroyukiex</a> for the solution.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 702591,
      "author_name": "tensorbot",
      "author_url": "",
      "post_date": "12/24/2019 22:03:03",
      "content": "<p>Thanks for sharing. Good luck with the final result.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 702684,
      "author_name": "johnt666",
      "author_url": "",
      "post_date": "12/25/2019 02:27:51",
      "content": "<p>thanks</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 704098,
      "author_name": "yamsam",
      "author_url": "",
      "post_date": "12/27/2019 03:40:16",
      "content": "<p>Thanks for sharing your great solution, <a href=\"/hiroyukiex\">@hiroyukiex</a> \nI have been impressed by your work throughout this competiton 😄 </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 704671,
      "author_name": "zyj5353",
      "author_url": "",
      "post_date": "12/27/2019 20:06:49",
      "content": "<p>Thanks for sharing this.\nHow do you find the optimized weight for your ensemble?</p>",
      "votes": null,
      "replies": [
        {
          "id": 704729,
          "author_name": "hiroyukiex",
          "author_url": "",
          "post_date": "12/27/2019 23:49:07",
          "content": "<p>Based on site0,1,2,15 leakage and public LB.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 704992,
      "author_name": "proletheus",
      "author_url": "",
      "post_date": "12/28/2019 09:03:10",
      "content": "<p>damn, what a crazy shake-up</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 714068,
      "author_name": "jt120lz",
      "author_url": "",
      "post_date": "01/09/2020 02:26:44",
      "content": "<p>sad</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 761470,
      "author_name": "shaochun",
      "author_url": "",
      "post_date": "03/02/2020 14:54:20",
      "content": "<p>Just out of curosity, why would you use models with different seeds? How did you come up with this idea ? <a href=\"/hiroyukiex\">@hiroyukiex</a> </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "700994": "Since we can “feel free to post solutions and write-ups” now according to https://www.kaggle.com/c/ashrae-energy-prediction/discussion/122296\nI summarize my solution.\n\nI appreciate ASHRAE and Kaggle for this really interesting competition. In spite of some terrible leakage, this competition is not destroyed thanks to sincere kagglers and rational rules clarification by organizers.\n\n[Feature Engineering and Feature Selection]\n-Final model used only 18 features.\n-I tried a lot of features but many were not useful.\n-Though dew temperature has high feature importance, I removed dew temperature because CV was better without it. I think air temperature is more important and dew temperature harms the contribution of air temperature.\n-Categorical Multiplication had a slight positive impact. For example site_id_and_meter.\n\n[Validation Strategy]\n-Mainly based on [1-6] train [7-12] valid. [1-6] means January to June.\n-Also watched [7-12] train [1-6] valid, and [1-9] train [10-12] valid.\n-After leakage, I also validated by site0,1,2,15.\n\n[Outlier Removal]\n-The most important part.\n-I plotted and watched all time-series carefully, and extracted so many rules that may detect outlier. I evaluated over 100 rules by the above Validation Strategy one by one.\n-Examples of effective rules: “Meter 0 and long 0 segment”/”Meter 2 and start before April and long 0 segment”/”0 segments in many building at the same time”/”day average is too small in January comparing with December”.\n\n[Single Model]\n-Only LGBM.\n-I tried CatBoost/time-series based methods but not worked.\n-Tuned Parameters: num_leaves=127, feature_fraction=0.6.\n\n[Ensemble]\n-Totally 32 LGBM models.\n-4 random seed averages for each model.\n-[1-6] train model and [7-12] train model, similar to half-and-half kernel.\n-Optimized weights for each model (Important).\n--Basically, weight for [7-12] model was set higher than weight for [1-6], since [7-12] model was created from recent data.\n--Furthermore, weight for [7-12] model was set higher for test data from July to December.\n--Weight for [1-6] model was set higher for test data whose time-series has few train data (due to outliers) in [7-12].\n\n[PostProcess]\n-Plotted all time-series before submission and extracted some effective postprocess rules that may improve LB score.\n--Modified to smaller value by applying piecewise linear function f. For example, 9.8 before log1p is modified to f(9.8)≒9.7. I searched optimal f and LB improved around 0.002. I think it is effective because there is some “unpredictable 0” but there is few “unpredictable large value“ (Important).\n--Clipped to [0.1, 10.5] before log1p.\n\n[Leak]\n-Replaced leaked label just before submission (site0,1,2,15 and part of site4)\n-Used for validation (site0,1,2,15)\n-No other external data, no leaked data in training data, no other methods to exploit leakage.\n\nThank you for all comments! I will try to reply all questions within 24-48 business hours.",
    "700997": "great solution",
    "701230": "Great job. And how did you train the 32 LGBM ? What's the difference between each other ?",
    "701362": "2×4×2×2=32\n2 -&gt; [1-6] train model or [7-12] train model (important)\n4 -&gt; 4 random seed average (effective)\n2 -&gt; Remove all suspicious outlier or remove only obvious outlier (slightly effective)\n2 -&gt; Modify site0 electric units or not (almost no effects)",
    "701382": "Great job! Mean and std value of air and dew temperature also worked in my best single model, and I found that spliting data into month groups performs better than just KFold.  However, I found that 6 groups is better than 4 and 2, while your best single model is 2 groups.  Look forward to your code part in notebook!!",
    "701496": "Congrats! How did you combine the ensembles' outputs? Mean? Median?",
    "701653": "wonderful solution, thanks for sharing @hiroyukiex , I would love to hear more for the outlier detection rules and those 32 lgbm models that you used for ensembling",
    "701921": "Thank you @hiroyukiex for the solution.",
    "702591": "Thanks for sharing. Good luck with the final result.",
    "702636": "8 predictions combined like the figure.\n-Simple mean in terms of 4 red predictions (multiply 1/4).\n-w is optimied (Please read [Ensemble] section in details)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F995847%2F8a0c2ba6092e727a18426e27dab9bc86%2Fashrae_discussion1.PNG?generation=1577233464436233&amp;alt=media)\n\n\nIn fact, each red prediction is created from 4 models, but almost no effects.\nI think only 8 models are enough rather than 32 to get near-optimal score.",
    "702648": "Most of my outlier rules are so complicated and difficult to tell strictly, but they are mainly based on \"constant-segment-info\" and \"day-mean\".\n\n[constant-segment-info]\n-To deal with constant outliers.\n-Extract (nearly) constant segments with segment features.\n-Examples of segment features are start_day, end_day, length, count_of_segments_in_the_time_series, count_of_long_segments_in_the_time_series, count_of_segments_with_same_start_day.\n\n[day-avg]\n-To deal with non-constant outliers.\n-day-avg stands for Groupby([\"building_id\",\"meter\",\"day\"])[\"meter_reading\"].mean()\n-Also used day-group-avg (group represents 15days interval)\n-day-group with definitely and weirdly small values are removed.",
    "702684": "thanks",
    "702761": "thanks @hiroyukiex , I really think the outlier removal has made the huge difference, good luck",
    "702984": "Got it! Nice approach!",
    "704098": "Thanks for sharing your great solution, @hiroyukiex \nI have been impressed by your work throughout this competiton 😄",
    "704671": "Thanks for sharing this.\nHow do you find the optimized weight for your ensemble?",
    "704729": "Based on site0,1,2,15 leakage and public LB.",
    "704992": "damn, what a crazy shake-up",
    "714068": "sad",
    "761470": "Just out of curosity, why would you use models with different seeds? How did you come up with this idea ? @hiroyukiex"
  },
  "source": "existing_discussion",
  "complete": true,
  "competition_id": 9994,
  "competition_slug": "ashrae-energy-prediction",
  "team_id": 3800088,
  "solution_url": "/competitions/ashrae-energy-prediction/writeups/hiroyuki-namba-497th-place-shake-down-solution-pub"
}