def getWeatherFeature(): data = readData.loadResidentialData() sumLoad = np.zeros((35040,)) #userLoad = readData.getUserData(data, 0) for i in range(144): sumLoad += readData.getUserData(data, i) load_1hr = changeInterval.From15minTo1hour(sumLoad) # load weather data #weather_data = pd.read_csv('F:/OneDrive/Load Forecast/residential/data/weather2013_Austin.csv') weather_data = pd.read_csv('F:/SkyDrive/Load Forecast/residential/data/weather2013_Austin.csv') # test correlations corr_temp = sp.pearsonr(load_1hr, np.array(weather_data['temperature']))[0] corr_humidity = sp.pearsonr(load_1hr, np.array(weather_data['humidity']))[0] corr_pressure = sp.pearsonr(load_1hr, np.array(weather_data['pressure']))[0] corr_precip = sp.pearsonr(load_1hr, np.array(weather_data['precip_intensity']))[0] print(corr_temp, corr_humidity, corr_pressure, corr_precip) # selected features: temperature, humidity, pressure temperature = np.array(weather_data['temperature']) temperature = normalize(temperature) humidity = np.array(weather_data['humidity']) humidity = normalize(humidity) pressure = np.array(weather_data['pressure']) pressure = normalize(pressure) return(temperature, humidity, pressure)
if __name__ == "__main__": # import load data data = readData.loadResidentialData() sumLoad = np.zeros((35040, )) #userLoad = readData.getUserData(data, 0) for i in range(144): sumLoad += readData.getUserData(data, i) # import weather data (temperature, humidity, pressure) = load_weather_corr.getWeatherFeature() # import cycles data (dailycycle, weeklycycle) = cycles.getCycles() sumLoad = changeInterval.From15minTo1hour(sumLoad) MAPE_sum = 0.0 RMSPR_sum = 0.0 for curr_day in range(56, 364): print(curr_day) (mape, rmspe) = RNN_LSTM(sumLoad, curr_day) MAPE_sum += mape RMSPR_sum += rmspe days_sample = 365 - 1 - 56 MAPE_sum = MAPE_sum / days_sample RMSPR_sum = RMSPR_sum / days_sample print('AVERAGE MAPE: %.2f, RMSPE: %.2f' % (MAPE_sum, RMSPR_sum))