{
  "id": 124226,
  "title": "Sharing what helped",
  "url": "/competitions/ashrae-energy-prediction/writeups/ods-ai-nuclear-energy-sharing-what-helped",
  "author_name": "",
  "post_date": "2020-01-11T00:08:17.310Z",
  "votes": 12,
  "comment_count": 7,
  "views": 0,
  "content": "<p>It was unfortunate that this competition was plagued by leaks, but it was pretty much a straight-forward energy forecasting problem. I learned a bit about time-series CV, which was my reason for joining. With that said, here are things that I’ve added to my approach. In retrospect, I could have data cleaned better with the non-electricity meters, but live and learn.</p>\n\n<p><em>weather</em>\nWeather is known to be one of the strongest drivers of energy consumption. With that said, typical approaches have been to lag and/or shift weather. Recent literature on energy forecasting have explored exponential weighted moving averages; this helped my model extremely. </p>\n\n<p><em>trend</em>\nAdding a trend feature in forecasting tends to usually help than not. In this case, I added one that mimicked the winning solutions from GEFCOM. Had there been more than one year of data, I would have included an intra-year trend as well.</p>\n\n<p><em>2-phase CV</em>\nI replicated CPMP’s 2-phase for training and predicting.</p>\n\n<p>Some things that I wished I tried:\n- partially-escaping seasonality by developing models at different subsets of time; in my work, I develop models by hour. This helps to escape auto-correlation issues.\n- data-clean: it was obvious the distributions for non-electricity were skewed due to 0 readings. I saw on the last night of competition that certain meters were 0 imputed while the corresponding day/time were missing in the electricity profile.\n- hedge leaks better. I was torn with leveraging leaks because it took away the task of forecasting energy in a real-world setting; imagine trying to explain this method to a public utilities commission. My intent was to learn something to bring back to my job. </p>\n\n<p>With that said, I was still happy with my approach in that most of the methods I used would have passed the PUC sniff test and it placed quite high on the leader board. Given the close spread of the RMSE towards the top, it was good to know that I didn't have to rely much on gimmicky methods to obtain a decent forecast. In this case, domain knowledge came in handy.</p>\n\n<p>I also want to give a huge shout-out to <a href=\"/cpmpml\">@cpmpml</a>. I learned a lot from him over the years in regards to forecasting, and my successes in my job were stemmed from him. Also, <a href=\"/mmotoki\">@mmotoki</a> for pushing me to do better. I never appreciated what it meant to have a rival, but my successes on Kaggle wouldn’t have happened it it weren’t for him. he deserves number 1 given his crazy work ethics; thanks for teaching me to push myself.</p>\n\n<p>UPDATE (for DietHard):\nNothing special:\n```</p>\n\n<h1>holidays</h1>\n\n<p>from datetime import datetime, date, timedelta\nfrom pandas.tseries.holiday import Holiday, AbstractHolidayCalendar, nearest_workday, MO, TU, WE, TH, FR\nfrom pandas.tseries.holiday import USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, USLaborDay, USThanksgivingDay\nfrom pandas import DateOffset, Series, Timestamp, date_range</p>\n\n<p>def daterange(date1, date2):\n    for n in range(int ((date2 - date1).days)+1):\n        yield date1 + timedelta(n)</p>\n\n<p>class Holiday(AbstractHolidayCalendar):\n    rules = [\n        Holiday(\"New Year's Day -1\", month=12, day=31),\n        Holiday(\"New Year's Day\", month=1, day=1),</p>\n\n<h1>USMartinLutherKingJr,</h1>\n\n<h1>USPresidentsDay,</h1>\n\n<h1>USMemorialDay,</h1>\n\n<pre><code>    Holiday('Independence Day', month=7, day=4, observance=nearest_workday),\n    USLaborDay,\n</code></pre>\n\n<h1>Holiday(\"Veteran's Day\", month=11, day=11),</h1>\n\n<pre><code>    USThanksgivingDay,    \n    Holiday(\"Christmas Eve\", month=12, day=24),\n    Holiday('Christmas', month=12, day=25, observance=nearest_workday),\n    Holiday(\"Boxing Day\", month=12, day=26),\n]\n</code></pre>\n\n<p>def create_holidays(year_start, year_end): <br>\n    cal = Holiday()\n    holidays = []\n    for i, year in enumerate(range(year_start, year_end+1)):\n        # default holidays\n        holiday_dates = cal.holidays(start=date(year,1,1), end=date(year,12,31))\n        for holiday in holiday_dates:\n            holidays.append(holiday.date())\n    return holidays</p>\n\n<p>holidays = create_holidays(2016, 2018)\ndf['is_holiday'] = df['timestamp'].isin(holidays) * 1</p>\n\n<h1>exponential weighted moving average</h1>\n\n<p>ewma = pd.Series.ewm\nweather['air_temperature_ewma_day'] = ewma(weather['air_temperature'], span=24, adjust=True).mean()\nweather['air_temperature_ewma_week'] = ewma(weather['air_temperature'], span=24*7, adjust=True).mean()\nweather['air_temperature_ewma_month'] = ewma(weather['air_temperature'], span=24*30, adjust=True).mean()</p>\n\n<h1>time trend</h1>\n\n<p>time_trend = pd.DataFrame({'dt': pd.date_range(config['timeframe']['start'], config['timeframe']['end'], freq='H')})\ntime_trend['time_trend'] = time_trend[\"time_trend\"] = range(0, 0+len(time_trend))\ntime_trend_dict = create_dictionary(time_trend[\"dt\"], time_trend['time_trend'])\ndf['time_trend'] = df['timestamp'].map(time_trend_dict)\ndf['time_trend'] = df['time_trend'].astype(np.float16)\n```</p>",
  "messages": [
    {
      "id": "708832",
      "postDate": "01/02/2020 18:19:55",
      "content": "<p>It was unfortunate that this competition was plagued by leaks, but it was pretty much a straight-forward energy forecasting problem. I learned a bit about time-series CV, which was my reason for joining. With that said, here are things that I’ve added to my approach. In retrospect, I could have data cleaned better with the non-electricity meters, but live and learn.</p>\n\n<p><em>weather</em>\nWeather is known to be one of the strongest drivers of energy consumption. With that said, typical approaches have been to lag and/or shift weather. Recent literature on energy forecasting have explored exponential weighted moving averages; this helped my model extremely. </p>\n\n<p><em>trend</em>\nAdding a trend feature in forecasting tends to usually help than not. In this case, I added one that mimicked the winning solutions from GEFCOM. Had there been more than one year of data, I would have included an intra-year trend as well.</p>\n\n<p><em>2-phase CV</em>\nI replicated CPMP’s 2-phase for training and predicting.</p>\n\n<p>Some things that I wished I tried:\n- partially-escaping seasonality by developing models at different subsets of time; in my work, I develop models by hour. This helps to escape auto-correlation issues.\n- data-clean: it was obvious the distributions for non-electricity were skewed due to 0 readings. I saw on the last night of competition that certain meters were 0 imputed while the corresponding day/time were missing in the electricity profile.\n- hedge leaks better. I was torn with leveraging leaks because it took away the task of forecasting energy in a real-world setting; imagine trying to explain this method to a public utilities commission. My intent was to learn something to bring back to my job. </p>\n\n<p>With that said, I was still happy with my approach in that most of the methods I used would have passed the PUC sniff test and it placed quite high on the leader board. Given the close spread of the RMSE towards the top, it was good to know that I didn't have to rely much on gimmicky methods to obtain a decent forecast. In this case, domain knowledge came in handy.</p>\n\n<p>I also want to give a huge shout-out to <a href=\"/cpmpml\">@cpmpml</a>. I learned a lot from him over the years in regards to forecasting, and my successes in my job were stemmed from him. Also, <a href=\"/mmotoki\">@mmotoki</a> for pushing me to do better. I never appreciated what it meant to have a rival, but my successes on Kaggle wouldn’t have happened it it weren’t for him. he deserves number 1 given his crazy work ethics; thanks for teaching me to push myself.</p>\n\n<p>UPDATE (for DietHard):\nNothing special:\n```</p>\n\n<h1>holidays</h1>\n\n<p>from datetime import datetime, date, timedelta\nfrom pandas.tseries.holiday import Holiday, AbstractHolidayCalendar, nearest_workday, MO, TU, WE, TH, FR\nfrom pandas.tseries.holiday import USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, USLaborDay, USThanksgivingDay\nfrom pandas import DateOffset, Series, Timestamp, date_range</p>\n\n<p>def daterange(date1, date2):\n    for n in range(int ((date2 - date1).days)+1):\n        yield date1 + timedelta(n)</p>\n\n<p>class Holiday(AbstractHolidayCalendar):\n    rules = [\n        Holiday(\"New Year's Day -1\", month=12, day=31),\n        Holiday(\"New Year's Day\", month=1, day=1),</p>\n\n<h1>USMartinLutherKingJr,</h1>\n\n<h1>USPresidentsDay,</h1>\n\n<h1>USMemorialDay,</h1>\n\n<pre><code>    Holiday('Independence Day', month=7, day=4, observance=nearest_workday),\n    USLaborDay,\n</code></pre>\n\n<h1>Holiday(\"Veteran's Day\", month=11, day=11),</h1>\n\n<pre><code>    USThanksgivingDay,    \n    Holiday(\"Christmas Eve\", month=12, day=24),\n    Holiday('Christmas', month=12, day=25, observance=nearest_workday),\n    Holiday(\"Boxing Day\", month=12, day=26),\n]\n</code></pre>\n\n<p>def create_holidays(year_start, year_end): <br>\n    cal = Holiday()\n    holidays = []\n    for i, year in enumerate(range(year_start, year_end+1)):\n        # default holidays\n        holiday_dates = cal.holidays(start=date(year,1,1), end=date(year,12,31))\n        for holiday in holiday_dates:\n            holidays.append(holiday.date())\n    return holidays</p>\n\n<p>holidays = create_holidays(2016, 2018)\ndf['is_holiday'] = df['timestamp'].isin(holidays) * 1</p>\n\n<h1>exponential weighted moving average</h1>\n\n<p>ewma = pd.Series.ewm\nweather['air_temperature_ewma_day'] = ewma(weather['air_temperature'], span=24, adjust=True).mean()\nweather['air_temperature_ewma_week'] = ewma(weather['air_temperature'], span=24*7, adjust=True).mean()\nweather['air_temperature_ewma_month'] = ewma(weather['air_temperature'], span=24*30, adjust=True).mean()</p>\n\n<h1>time trend</h1>\n\n<p>time_trend = pd.DataFrame({'dt': pd.date_range(config['timeframe']['start'], config['timeframe']['end'], freq='H')})\ntime_trend['time_trend'] = time_trend[\"time_trend\"] = range(0, 0+len(time_trend))\ntime_trend_dict = create_dictionary(time_trend[\"dt\"], time_trend['time_trend'])\ndf['time_trend'] = df['timestamp'].map(time_trend_dict)\ndf['time_trend'] = df['time_trend'].astype(np.float16)\n```</p>",
      "rawMarkdown": "It was unfortunate that this competition was plagued by leaks, but it was pretty much a straight-forward energy forecasting problem. I learned a bit about time-series CV, which was my reason for joining. With that said, here are things that I’ve added to my approach. In retrospect, I could have data cleaned better with the non-electricity meters, but live and learn.\n\n*weather*\nWeather is known to be one of the strongest drivers of energy consumption. With that said, typical approaches have been to lag and/or shift weather. Recent literature on energy forecasting have explored exponential weighted moving averages; this helped my model extremely. \n\n*trend*\nAdding a trend feature in forecasting tends to usually help than not. In this case, I added one that mimicked the winning solutions from GEFCOM. Had there been more than one year of data, I would have included an intra-year trend as well.\n\n*2-phase CV*\nI replicated CPMP’s 2-phase for training and predicting.\n\nSome things that I wished I tried:\n- partially-escaping seasonality by developing models at different subsets of time; in my work, I develop models by hour. This helps to escape auto-correlation issues.\n- data-clean: it was obvious the distributions for non-electricity were skewed due to 0 readings. I saw on the last night of competition that certain meters were 0 imputed while the corresponding day/time were missing in the electricity profile.\n- hedge leaks better. I was torn with leveraging leaks because it took away the task of forecasting energy in a real-world setting; imagine trying to explain this method to a public utilities commission. My intent was to learn something to bring back to my job. \n\nWith that said, I was still happy with my approach in that most of the methods I used would have passed the PUC sniff test and it placed quite high on the leader board. Given the close spread of the RMSE towards the top, it was good to know that I didn't have to rely much on gimmicky methods to obtain a decent forecast. In this case, domain knowledge came in handy.\n\nI also want to give a huge shout-out to @cpmpml. I learned a lot from him over the years in regards to forecasting, and my successes in my job were stemmed from him. Also, @mmotoki for pushing me to do better. I never appreciated what it meant to have a rival, but my successes on Kaggle wouldn’t have happened it it weren’t for him. he deserves number 1 given his crazy work ethics; thanks for teaching me to push myself.\n\nUPDATE (for DietHard):\nNothing special:\n```\n# holidays\n\nfrom datetime import datetime, date, timedelta\nfrom pandas.tseries.holiday import Holiday, AbstractHolidayCalendar, nearest_workday, MO, TU, WE, TH, FR\nfrom pandas.tseries.holiday import USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, USLaborDay, USThanksgivingDay\nfrom pandas import DateOffset, Series, Timestamp, date_range\n\ndef daterange(date1, date2):\n    for n in range(int ((date2 - date1).days)+1):\n        yield date1 + timedelta(n)\n        \n\nclass Holiday(AbstractHolidayCalendar):\n    rules = [\n        Holiday(\"New Year's Day -1\", month=12, day=31),\n        Holiday(\"New Year's Day\", month=1, day=1),\n#         USMartinLutherKingJr,\n#         USPresidentsDay,\n#         USMemorialDay,\n        Holiday('Independence Day', month=7, day=4, observance=nearest_workday),\n        USLaborDay,\n#         Holiday(\"Veteran's Day\", month=11, day=11),\n        USThanksgivingDay,    \n        Holiday(\"Christmas Eve\", month=12, day=24),\n        Holiday('Christmas', month=12, day=25, observance=nearest_workday),\n        Holiday(\"Boxing Day\", month=12, day=26),\n    ]\n\ndef create_holidays(year_start, year_end):    \n    cal = Holiday()\n    holidays = []\n    for i, year in enumerate(range(year_start, year_end+1)):\n        # default holidays\n        holiday_dates = cal.holidays(start=date(year,1,1), end=date(year,12,31))\n        for holiday in holiday_dates:\n            holidays.append(holiday.date())\n    return holidays\n\nholidays = create_holidays(2016, 2018)\ndf['is_holiday'] = df['timestamp'].isin(holidays) * 1\n    \n# exponential weighted moving average\newma = pd.Series.ewm\nweather['air_temperature_ewma_day'] = ewma(weather['air_temperature'], span=24, adjust=True).mean()\nweather['air_temperature_ewma_week'] = ewma(weather['air_temperature'], span=24*7, adjust=True).mean()\nweather['air_temperature_ewma_month'] = ewma(weather['air_temperature'], span=24*30, adjust=True).mean()\n\n# time trend\ntime_trend = pd.DataFrame({'dt': pd.date_range(config['timeframe']['start'], config['timeframe']['end'], freq='H')})\ntime_trend['time_trend'] = time_trend[\"time_trend\"] = range(0, 0+len(time_trend))\ntime_trend_dict = create_dictionary(time_trend[\"dt\"], time_trend['time_trend'])\ndf['time_trend'] = df['timestamp'].map(time_trend_dict)\ndf['time_trend'] = df['time_trend'].astype(np.float16)\n```",
      "votes": null
    },
    {
      "id": "708852",
      "postDate": "01/02/2020 19:04:28",
      "content": "<p>Hi!\nI also did exponential weighted moving averages (something that I grabbed from stock-market forecasting) and results were not very good. If this worked for you I'd say that it does in combination of another strategy...\nCould you elaborate more on your first item there? models by hour? escape auto-correlation?</p>\n\n<p>Thanks!</p>",
      "rawMarkdown": "Hi!\nI also did exponential weighted moving averages (something that I grabbed from stock-market forecasting) and results were not very good. If this worked for you I'd say that it does in combination of another strategy...\nCould you elaborate more on your first item there? models by hour? escape auto-correlation?\n\nThanks!",
      "votes": null
    },
    {
      "id": "708883",
      "postDate": "01/02/2020 19:49:36",
      "content": "<p>Thanks for sharing. What was your trend features?</p>",
      "rawMarkdown": "Thanks for sharing. What was your trend features?",
      "votes": null
    },
    {
      "id": "708888",
      "postDate": "01/02/2020 19:58:17",
      "content": "<p>Basically, an incremental of 1 over the train+test span, over the total time points. This was a method that was revealed in the GEFCOM 2017 winning solution. </p>\n\n<p>In addition to this approach, there are ways to extract trend and seasonality prior to model fitting and adding it back in such as Dr. Smyl's approach in M4, which seems promising, and is something else I plan to explore further in my real work.</p>",
      "rawMarkdown": "Basically, an incremental of 1 over the train+test span, over the total time points. This was a method that was revealed in the GEFCOM 2017 winning solution. \n\nIn addition to this approach, there are ways to extract trend and seasonality prior to model fitting and adding it back in such as Dr. Smyl's approach in M4, which seems promising, and is something else I plan to explore further in my real work.",
      "votes": null
    },
    {
      "id": "708891",
      "postDate": "01/02/2020 20:02:37",
      "content": "<p>I performed EMWA across different windows of typical seasonality seen in load forecasting such as 24 hour, week, etc. I selected the \"best\" using the train-test feature selection shared in the IEEE competition. There were a lot of good ideas shared in that competition including timeseries  CV.</p>\n\n<p>In regards to escaping auto-correlation, this idea was actually proposed by Itron's forecasters. This approach tends to do better because the target distribution is tighter; especially, when your daily load profiles start to swing more with photovoltaic. This was also something that was used by Dr. Smyl in GEFCOM 2017. The only issue personally was the amount of time needed and the company I'm working at is currently going through an intense planning cycle so I didn't have much time to explore much ideas. I basically spent about a week on this competition, which made me hesitant to even participate.</p>\n\n<p>Energy forecasting literature is pretty rich thanks to data science. I wouldn't be surprised if better approaches are introduced within the next couple of years. With that said, the company I'm working for is going to be looking for 2 forecasters if anyone is interested in this work. Just look for jobs at Hawaii's largest utilities company ;)</p>",
      "rawMarkdown": "I performed EMWA across different windows of typical seasonality seen in load forecasting such as 24 hour, week, etc. I selected the \"best\" using the train-test feature selection shared in the IEEE competition. There were a lot of good ideas shared in that competition including timeseries  CV.\n\nIn regards to escaping auto-correlation, this idea was actually proposed by Itron's forecasters. This approach tends to do better because the target distribution is tighter; especially, when your daily load profiles start to swing more with photovoltaic. This was also something that was used by Dr. Smyl in GEFCOM 2017. The only issue personally was the amount of time needed and the company I'm working at is currently going through an intense planning cycle so I didn't have much time to explore much ideas. I basically spent about a week on this competition, which made me hesitant to even participate.\n\nEnergy forecasting literature is pretty rich thanks to data science. I wouldn't be surprised if better approaches are introduced within the next couple of years. With that said, the company I'm working for is going to be looking for 2 forecasters if anyone is interested in this work. Just look for jobs at Hawaii's largest utilities company ;)",
      "votes": null
    },
    {
      "id": "708932",
      "postDate": "01/02/2020 20:57:42",
      "content": "<p>Well, this is my first competition and pretty much used it to learn something, and boy I did.\nTook me some googling but I found some of the references you are talking about (had no clue about GEFCOM nor any of those people you mentioned) and it looks like I'm gonna have something to read now.</p>\n\n<p>Thanks for sharing!</p>\n\n<p>By the way, would be very interested in looking at your full solution if you are ever willing to publish it.\nI work in the field and despite competition results, all of this helps my job as well.</p>",
      "rawMarkdown": "Well, this is my first competition and pretty much used it to learn something, and boy I did.\nTook me some googling but I found some of the references you are talking about (had no clue about GEFCOM nor any of those people you mentioned) and it looks like I'm gonna have something to read now.\n\nThanks for sharing!\n\nBy the way, would be very interested in looking at your full solution if you are ever willing to publish it.\nI work in the field and despite competition results, all of this helps my job as well.",
      "votes": null
    },
    {
      "id": "715893",
      "postDate": "01/10/2020 23:47:54",
      "content": "<p>I've posted the code I used to create said features.</p>\n\n<p>BTW, if you don't mind, where do you work? I'm always interested in meeting people in the industry.</p>",
      "rawMarkdown": "I've posted the code I used to create said features.\n\nBTW, if you don't mind, where do you work? I'm always interested in meeting people in the industry.",
      "votes": null
    },
    {
      "id": "717363",
      "postDate": "01/13/2020 03:56:16",
      "content": "<p>Thank you very much for sharing! We would like to add your solution to our analysis of the top processes and models. Please let us know how you would like to be acknowledged. The default will be what you have on your profile. Thanks again!</p>\n\n<p><strong>Also, for everyone else, we are in the process of curating a directory of Notebooks for building performance engineers and analysts from the competition that will serve as a recipe book for beginners as well as experts who are curious to learn about certain topics. We highly encourage you all to share your solutions (or any part of your process) as a notebook for this purpose. We will acknowledge the authors of all notebooks in this process, so please annotate your notebook or profile with how you would like to be acknowledged. We will also include general solutions and process information that is not in notebooks as well. It would also be helpful if you could indicate whether you are an ASHRAE member.</strong></p>",
      "rawMarkdown": "Thank you very much for sharing! We would like to add your solution to our analysis of the top processes and models. Please let us know how you would like to be acknowledged. The default will be what you have on your profile. Thanks again!\n\n**Also, for everyone else, we are in the process of curating a directory of Notebooks for building performance engineers and analysts from the competition that will serve as a recipe book for beginners as well as experts who are curious to learn about certain topics. We highly encourage you all to share your solutions (or any part of your process) as a notebook for this purpose. We will acknowledge the authors of all notebooks in this process, so please annotate your notebook or profile with how you would like to be acknowledged. We will also include general solutions and process information that is not in notebooks as well. It would also be helpful if you could indicate whether you are an ASHRAE member.**",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 708852,
      "author_name": "kevincastro",
      "author_url": "",
      "post_date": "01/02/2020 19:04:28",
      "content": "<p>Hi!\nI also did exponential weighted moving averages (something that I grabbed from stock-market forecasting) and results were not very good. If this worked for you I'd say that it does in combination of another strategy...\nCould you elaborate more on your first item there? models by hour? escape auto-correlation?</p>\n\n<p>Thanks!</p>",
      "votes": null,
      "replies": [
        {
          "id": 708891,
          "author_name": "learnmower",
          "author_url": "",
          "post_date": "01/02/2020 20:02:37",
          "content": "<p>I performed EMWA across different windows of typical seasonality seen in load forecasting such as 24 hour, week, etc. I selected the \"best\" using the train-test feature selection shared in the IEEE competition. There were a lot of good ideas shared in that competition including timeseries  CV.</p>\n\n<p>In regards to escaping auto-correlation, this idea was actually proposed by Itron's forecasters. This approach tends to do better because the target distribution is tighter; especially, when your daily load profiles start to swing more with photovoltaic. This was also something that was used by Dr. Smyl in GEFCOM 2017. The only issue personally was the amount of time needed and the company I'm working at is currently going through an intense planning cycle so I didn't have much time to explore much ideas. I basically spent about a week on this competition, which made me hesitant to even participate.</p>\n\n<p>Energy forecasting literature is pretty rich thanks to data science. I wouldn't be surprised if better approaches are introduced within the next couple of years. With that said, the company I'm working for is going to be looking for 2 forecasters if anyone is interested in this work. Just look for jobs at Hawaii's largest utilities company ;)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 708932,
          "author_name": "kevincastro",
          "author_url": "",
          "post_date": "01/02/2020 20:57:42",
          "content": "<p>Well, this is my first competition and pretty much used it to learn something, and boy I did.\nTook me some googling but I found some of the references you are talking about (had no clue about GEFCOM nor any of those people you mentioned) and it looks like I'm gonna have something to read now.</p>\n\n<p>Thanks for sharing!</p>\n\n<p>By the way, would be very interested in looking at your full solution if you are ever willing to publish it.\nI work in the field and despite competition results, all of this helps my job as well.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 715893,
          "author_name": "learnmower",
          "author_url": "",
          "post_date": "01/10/2020 23:47:54",
          "content": "<p>I've posted the code I used to create said features.</p>\n\n<p>BTW, if you don't mind, where do you work? I'm always interested in meeting people in the industry.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 708883,
      "author_name": "gunesevitan",
      "author_url": "",
      "post_date": "01/02/2020 19:49:36",
      "content": "<p>Thanks for sharing. What was your trend features?</p>",
      "votes": null,
      "replies": [
        {
          "id": 708888,
          "author_name": "learnmower",
          "author_url": "",
          "post_date": "01/02/2020 19:58:17",
          "content": "<p>Basically, an incremental of 1 over the train+test span, over the total time points. This was a method that was revealed in the GEFCOM 2017 winning solution. </p>\n\n<p>In addition to this approach, there are ways to extract trend and seasonality prior to model fitting and adding it back in such as Dr. Smyl's approach in M4, which seems promising, and is something else I plan to explore further in my real work.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 717363,
      "author_name": "claytonmiller",
      "author_url": "",
      "post_date": "01/13/2020 03:56:16",
      "content": "<p>Thank you very much for sharing! We would like to add your solution to our analysis of the top processes and models. Please let us know how you would like to be acknowledged. The default will be what you have on your profile. Thanks again!</p>\n\n<p><strong>Also, for everyone else, we are in the process of curating a directory of Notebooks for building performance engineers and analysts from the competition that will serve as a recipe book for beginners as well as experts who are curious to learn about certain topics. We highly encourage you all to share your solutions (or any part of your process) as a notebook for this purpose. We will acknowledge the authors of all notebooks in this process, so please annotate your notebook or profile with how you would like to be acknowledged. We will also include general solutions and process information that is not in notebooks as well. It would also be helpful if you could indicate whether you are an ASHRAE member.</strong></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "708832": "It was unfortunate that this competition was plagued by leaks, but it was pretty much a straight-forward energy forecasting problem. I learned a bit about time-series CV, which was my reason for joining. With that said, here are things that I’ve added to my approach. In retrospect, I could have data cleaned better with the non-electricity meters, but live and learn.\n\n*weather*\nWeather is known to be one of the strongest drivers of energy consumption. With that said, typical approaches have been to lag and/or shift weather. Recent literature on energy forecasting have explored exponential weighted moving averages; this helped my model extremely. \n\n*trend*\nAdding a trend feature in forecasting tends to usually help than not. In this case, I added one that mimicked the winning solutions from GEFCOM. Had there been more than one year of data, I would have included an intra-year trend as well.\n\n*2-phase CV*\nI replicated CPMP’s 2-phase for training and predicting.\n\nSome things that I wished I tried:\n- partially-escaping seasonality by developing models at different subsets of time; in my work, I develop models by hour. This helps to escape auto-correlation issues.\n- data-clean: it was obvious the distributions for non-electricity were skewed due to 0 readings. I saw on the last night of competition that certain meters were 0 imputed while the corresponding day/time were missing in the electricity profile.\n- hedge leaks better. I was torn with leveraging leaks because it took away the task of forecasting energy in a real-world setting; imagine trying to explain this method to a public utilities commission. My intent was to learn something to bring back to my job. \n\nWith that said, I was still happy with my approach in that most of the methods I used would have passed the PUC sniff test and it placed quite high on the leader board. Given the close spread of the RMSE towards the top, it was good to know that I didn't have to rely much on gimmicky methods to obtain a decent forecast. In this case, domain knowledge came in handy.\n\nI also want to give a huge shout-out to @cpmpml. I learned a lot from him over the years in regards to forecasting, and my successes in my job were stemmed from him. Also, @mmotoki for pushing me to do better. I never appreciated what it meant to have a rival, but my successes on Kaggle wouldn’t have happened it it weren’t for him. he deserves number 1 given his crazy work ethics; thanks for teaching me to push myself.\n\nUPDATE (for DietHard):\nNothing special:\n```\n# holidays\n\nfrom datetime import datetime, date, timedelta\nfrom pandas.tseries.holiday import Holiday, AbstractHolidayCalendar, nearest_workday, MO, TU, WE, TH, FR\nfrom pandas.tseries.holiday import USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, USLaborDay, USThanksgivingDay\nfrom pandas import DateOffset, Series, Timestamp, date_range\n\ndef daterange(date1, date2):\n    for n in range(int ((date2 - date1).days)+1):\n        yield date1 + timedelta(n)\n        \n\nclass Holiday(AbstractHolidayCalendar):\n    rules = [\n        Holiday(\"New Year's Day -1\", month=12, day=31),\n        Holiday(\"New Year's Day\", month=1, day=1),\n#         USMartinLutherKingJr,\n#         USPresidentsDay,\n#         USMemorialDay,\n        Holiday('Independence Day', month=7, day=4, observance=nearest_workday),\n        USLaborDay,\n#         Holiday(\"Veteran's Day\", month=11, day=11),\n        USThanksgivingDay,    \n        Holiday(\"Christmas Eve\", month=12, day=24),\n        Holiday('Christmas', month=12, day=25, observance=nearest_workday),\n        Holiday(\"Boxing Day\", month=12, day=26),\n    ]\n\ndef create_holidays(year_start, year_end):    \n    cal = Holiday()\n    holidays = []\n    for i, year in enumerate(range(year_start, year_end+1)):\n        # default holidays\n        holiday_dates = cal.holidays(start=date(year,1,1), end=date(year,12,31))\n        for holiday in holiday_dates:\n            holidays.append(holiday.date())\n    return holidays\n\nholidays = create_holidays(2016, 2018)\ndf['is_holiday'] = df['timestamp'].isin(holidays) * 1\n    \n# exponential weighted moving average\newma = pd.Series.ewm\nweather['air_temperature_ewma_day'] = ewma(weather['air_temperature'], span=24, adjust=True).mean()\nweather['air_temperature_ewma_week'] = ewma(weather['air_temperature'], span=24*7, adjust=True).mean()\nweather['air_temperature_ewma_month'] = ewma(weather['air_temperature'], span=24*30, adjust=True).mean()\n\n# time trend\ntime_trend = pd.DataFrame({'dt': pd.date_range(config['timeframe']['start'], config['timeframe']['end'], freq='H')})\ntime_trend['time_trend'] = time_trend[\"time_trend\"] = range(0, 0+len(time_trend))\ntime_trend_dict = create_dictionary(time_trend[\"dt\"], time_trend['time_trend'])\ndf['time_trend'] = df['timestamp'].map(time_trend_dict)\ndf['time_trend'] = df['time_trend'].astype(np.float16)\n```",
    "708852": "Hi!\nI also did exponential weighted moving averages (something that I grabbed from stock-market forecasting) and results were not very good. If this worked for you I'd say that it does in combination of another strategy...\nCould you elaborate more on your first item there? models by hour? escape auto-correlation?\n\nThanks!",
    "708883": "Thanks for sharing. What was your trend features?",
    "708888": "Basically, an incremental of 1 over the train+test span, over the total time points. This was a method that was revealed in the GEFCOM 2017 winning solution. \n\nIn addition to this approach, there are ways to extract trend and seasonality prior to model fitting and adding it back in such as Dr. Smyl's approach in M4, which seems promising, and is something else I plan to explore further in my real work.",
    "708891": "I performed EMWA across different windows of typical seasonality seen in load forecasting such as 24 hour, week, etc. I selected the \"best\" using the train-test feature selection shared in the IEEE competition. There were a lot of good ideas shared in that competition including timeseries  CV.\n\nIn regards to escaping auto-correlation, this idea was actually proposed by Itron's forecasters. This approach tends to do better because the target distribution is tighter; especially, when your daily load profiles start to swing more with photovoltaic. This was also something that was used by Dr. Smyl in GEFCOM 2017. The only issue personally was the amount of time needed and the company I'm working at is currently going through an intense planning cycle so I didn't have much time to explore much ideas. I basically spent about a week on this competition, which made me hesitant to even participate.\n\nEnergy forecasting literature is pretty rich thanks to data science. I wouldn't be surprised if better approaches are introduced within the next couple of years. With that said, the company I'm working for is going to be looking for 2 forecasters if anyone is interested in this work. Just look for jobs at Hawaii's largest utilities company ;)",
    "708932": "Well, this is my first competition and pretty much used it to learn something, and boy I did.\nTook me some googling but I found some of the references you are talking about (had no clue about GEFCOM nor any of those people you mentioned) and it looks like I'm gonna have something to read now.\n\nThanks for sharing!\n\nBy the way, would be very interested in looking at your full solution if you are ever willing to publish it.\nI work in the field and despite competition results, all of this helps my job as well.",
    "715893": "I've posted the code I used to create said features.\n\nBTW, if you don't mind, where do you work? I'm always interested in meeting people in the industry.",
    "717363": "Thank you very much for sharing! We would like to add your solution to our analysis of the top processes and models. Please let us know how you would like to be acknowledged. The default will be what you have on your profile. Thanks again!\n\n**Also, for everyone else, we are in the process of curating a directory of Notebooks for building performance engineers and analysts from the competition that will serve as a recipe book for beginners as well as experts who are curious to learn about certain topics. We highly encourage you all to share your solutions (or any part of your process) as a notebook for this purpose. We will acknowledge the authors of all notebooks in this process, so please annotate your notebook or profile with how you would like to be acknowledged. We will also include general solutions and process information that is not in notebooks as well. It would also be helpful if you could indicate whether you are an ASHRAE member.**"
  },
  "source": "existing_discussion",
  "complete": true,
  "competition_id": 9994,
  "competition_slug": "ashrae-energy-prediction",
  "team_id": 3999128,
  "solution_url": "/competitions/ashrae-energy-prediction/writeups/ods-ai-nuclear-energy-sharing-what-helped"
}