{"cells":[{"metadata":{},"cell_type":"markdown","source":"# What is ASHRAE Competition?"},{"metadata":{},"cell_type":"markdown","source":"In this competition, you’ll develop accurate models of metered building energy usage"},{"metadata":{},"cell_type":"markdown","source":"Data Download\n- kaggle competitions download -c ashrae-energy-prediction"},{"metadata":{},"cell_type":"markdown","source":"## Data description"},{"metadata":{},"cell_type":"markdown","source":"- building_metadata.csv\n        - site_id\n        - building_id\n        - primary_use\n        - square_feet\n        - year_built\n        - floor_count\n- train.csv\n        - building_id\n        - meter\n        - timestamp\n        - meter_reading\n- test.csv\n        - row_id\n        - building_id\n        - meter\n        - timestamp\n- weather_train.csv & weather_test.csv\n        - site_id\n        - timestamp\n        - air_temperature\n        - cloud_coverage\n        - dew_temperature\n        - precip_depth_1_hr\n        - sea_level_pressure\n        - wind_direction\n        - wind_speed"},{"metadata":{},"cell_type":"markdown","source":"- building_id - Foreign key for the building metadata.\n- meter - The meter id code. Read as {0: electricity, 1: chilledwater, 2: steam, 3: hotwater}. Not every building has all meter types.\n- timestamp - When the measurement was taken\n- meter_reading - The target variable. Energy consumption in kWh (or equivalent). Note that this is real data with measurement error, which we expect will impose a baseline level of modeling error. UPDATE: as discussed here, the site 0 electric meter readings are in kBTU.\n- site_id - Foreign key for the weather files.\n- building_id - Foreign key for training.csv\n- primary_use - Indicator of the primary category of activities for the building based on EnergyStar property type definitions\n        - Banking/financial services\n        - Education\n        - Entertainment/public assembly\n        - Food sales and service\n        - Healthcare\n        - Lodging/residential\n        - Manufacturing/industrial\n        - Mixed use\n        - Office\n        - Parking\n        - Public services\n        - Religious worship\n        - Retail\n        - Technology/science\n        - Services\n        - Utility\n        - Warehouse/storage\n        - Other \n- square_feet - Gross floor area of the building\n- year_built - Year building was opened\n- floor_count - Number of floors of the building\n- air_temperature - Degrees Celsius\n- cloud_coverage - Portion of the sky covered in clouds, in oktas\n- dew_temperature - Degrees Celsius\n- precip_depth_1_hr - Millimeters\n- sea_level_pressure - Millibar/hectopascals\n- wind_direction - Compass direction (0-360)\n- wind_speed - Meters per second"},{"metadata":{},"cell_type":"markdown","source":"# My solution"},{"metadata":{},"cell_type":"markdown","source":"- I used the data by feather format for fast loading\n=> https://www.kaggle.com/corochann/ashrae-feather-format-for-fast-loading\n- This solution got 92th rank"},{"metadata":{"trusted":true},"cell_type":"markdown","source":"- ensemble five different model with different feature engineering\n- conduct weighted average ensemble by using leak data as validation data"},{"metadata":{},"cell_type":"markdown","source":"## 1 : k-folds(k = 3) model"},{"metadata":{"trusted":true},"cell_type":"markdown","source":"- merge buidling and weather data into train data\n- separate timestamp into hour, mounth, weekday\n- fill and update the null value of weather data\n- drop \"timestamp\",\"sea_level_pressure\", \"wind_direction\", \"wind_speed\",\"year_built\",\"floor_count\"\n- label encode 'primary use'"},{"metadata":{},"cell_type":"markdown","source":"I conducted k-folds model with k is 3 by using LightGBM\n => https://www.kaggle.com/yunishi0716/k-folds-model"},{"metadata":{},"cell_type":"markdown","source":"## 2 half and half model"},{"metadata":{},"cell_type":"markdown","source":"- merge buidling and weather data into train data\n- add new features extracting from timestamp as hour, weekday\n- based on calender, add new feature, is_holiday"},{"metadata":{},"cell_type":"markdown","source":"I choose two-folds LightGBM split half and half => https://www.kaggle.com/yunishi0716/half-and-half-model-ashre?scriptVersionId=28053730"},{"metadata":{},"cell_type":"markdown","source":"## 3: Highway route4"},{"metadata":{},"cell_type":"markdown","source":"- remove weired data(t is reported in this discussion by @barnwellguy that All electricity meter is 0 until May 20 for site_id == 0)\n- fix time zone\n- add date featueres(hour, month, weekend, dayofweek)\n- fill the null values of weather by interpolation(linear, both limit direction)"},{"metadata":{},"cell_type":"markdown","source":"train the 3-folds LightGBM model by each meter type => https://www.kaggle.com/yunishi0716/3-folds-by-each-meter-type?scriptVersionId=28056268"},{"metadata":{},"cell_type":"markdown","source":"## 4: EDA model(3-folds LightGMB)"},{"metadata":{},"cell_type":"markdown","source":"- fill and update the null values of weather data as I did (1)k-folds model\n- add new features, Age(how long have been taken the building from the last time construction)\n- delete weired data as 3\n- delete train data with that meter type is electricity and meter reading is 0\n- add mean, median and std of meter reading groupby buidling_id, month, day of week and meter\n- drop year_built\n- drop columns which has more than 0.9 correlation to other columns"},{"metadata":{},"cell_type":"markdown","source":"Training model is 3-folds LightGMB => https://www.kaggle.com/kulkarnivishwanath/ashrae-great-energy-predictor-iii-eda-model"},{"metadata":{},"cell_type":"markdown","source":"## 5: data clean up model"},{"metadata":{},"cell_type":"markdown","source":"- drop row satisfying\n    - all electricity with 0 meter reading\n    - more than 48 hours run of steam and hot-water zero-reading(except to core summer month)\n    - more than 48 hours run of chilledwater zero-reading(except to ccur simultaneously at the start and end of the year)\n- drop electrical readings from the first 141 days of the data for site 0\n- drop building 1099\n- fill null values of weather data by interpolation\n- fix timestamp"},{"metadata":{},"cell_type":"markdown","source":"Training model is LightGBM => https://www.kaggle.com/purist1024/ashrae-simple-data-cleanup-lb-1-08-no-leaks/notebook"},{"metadata":{},"cell_type":"markdown","source":"# Weighted average ensemble and leak data validation"},{"metadata":{},"cell_type":"markdown","source":"Kernel => https://www.kaggle.com/yunishi0716/best-weight-searching3?scriptVersionId=25352432"}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":1}