欢迎来到本博客❤️❤️
博主优势:博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
本文目录如下:
目录
1 概述
2 运行结果
3 Python代码实现
4 参考文献
电能负荷预测按细粒度划分可分为粗度预测和细度预测。其中粗度预测则是将整个时间段的电能负荷数据进行训练,进而进行预测。而细度预测这是要考虑电能负荷季节,时间周期影响因子。
在进行城市居民电能负荷粗度预测时需要考虑比较如下三种情况的准确率:
- 利用上一时刻的电能负荷(power),温度(temperature),湿度(humidity),风速(speed)预测此刻的电能负荷,power_load_forecasting_V1
- 利用上一时刻的电能负荷(power)和此刻的温度(temperature),湿度(humidity),风速(speed)预测此刻的电能负荷,
- 利用上一若干时刻的电能负荷(power),温度(temperature),湿度(humidity),风速(speed)预测此刻的电能负荷,
在进行城市居民电能负荷细度预测时,除了要考虑如上问题时,还需要考虑季节,时间周期等影响因子:- 电力负荷往往具有周期性,夏季,冬季,过渡季(春季和秋季)用户用电量往往差距很大,因此在预测是可以考虑分开预测,
- 在各个季节进行预测是,我们还可以按天,周,月进行划分,
122/122 - 0s - loss: 0.0303 - val_loss: 0.0392 - 167ms/epoch - 1ms/step
Epoch 41/50
122/122 - 0s - loss: 0.0303 - val_loss: 0.0391 - 170ms/epoch - 1ms/step
Epoch 42/50
122/122 - 0s - loss: 0.0303 - val_loss: 0.0393 - 170ms/epoch - 1ms/step
Epoch 43/50
122/122 - 0s - loss: 0.0303 - val_loss: 0.0397 - 172ms/epoch - 1ms/step
Epoch 44/50
122/122 - 0s - loss: 0.0304 - val_loss: 0.0391 - 170ms/epoch - 1ms/step
Epoch 45/50
122/122 - 0s - loss: 0.0304 - val_loss: 0.0394 - 176ms/epoch - 1ms/step
Epoch 46/50
122/122 - 0s - loss: 0.0304 - val_loss: 0.0396 - 172ms/epoch - 1ms/step
Epoch 47/50
122/122 - 0s - loss: 0.0304 - val_loss: 0.0396 - 203ms/epoch - 2ms/step
Epoch 48/50
122/122 - 0s - loss: 0.0303 - val_loss: 0.0396 - 196ms/epoch - 2ms/step
Epoch 49/50
122/122 - 0s - loss: 0.0303 - val_loss: 0.0396 - 182ms/epoch - 1ms/step
Epoch 50/50
122/122 - 0s - loss: 0.0303 - val_loss: 0.0396 - 166ms/epoch - 1ms/step
Test RMSE: 110.218
Test mape: 0.117
Process finished with exit code 0
部分代码:
model.compile(loss='mae', optimizer='adam') # fit network history = model.fit(train_X, train_y, epochs=50, batch_size=72, validation_data=(test_X, test_y), verbose=2, shuffle=False) # plot history pyplot.plot(history.history['loss'], label='train') pyplot.plot(history.history['val_loss'], label='test') pyplot.legend() pyplot.show() # make a prediction yhat = model.predict(test_X) test_X = test_X.reshape((test_X.shape[0], test_X.shape[2])) # invert scaling for forecast inv_yhat = concatenate((yhat, test_X[:, 1:]), axis=1) inv_yhat = scaler.inverse_transform(inv_yhat) inv_yhat = inv_yhat[:, 0] # invert scaling for actual test_y = test_y.reshape((len(test_y), 1)) inv_y = concatenate((test_y, test_X[:, 1:]), axis=1) inv_y = scaler.inverse_transform(inv_y) inv_y = inv_y[:, 0] # calculate RMSE rmse = sqrt(mean_squared_error(inv_y, inv_yhat)) print('Test RMSE: %.3f' % rmse) # calculate MAPE mape = mean_absolute_percentage_error(inv_y, inv_yhat) print('Test mape: %.3f' % mape)
部分理论来源于网络,如有侵权请联系删除。