资源简介
月度用电预测DBN网络
代码片段和文件信息
%https://github.com/rasmusbergpalm/DeepLearnToolbox
%function test_example_DBN
%注意assert(all(x(:)>=0) && all(x(:)<=1) ‘all data in x must be in [0:1]‘)被改动;
addpath(genpath(‘E:\工作\本科毕设\2017\test2\test2\DeepLearnToolbox-master‘))
clear all;
clc;
close all;
clear;
filename =‘data.xlsx‘;
sheet = ‘data‘;
xlRange = ‘B3:E326‘;
W_read=xlsread(filenamesheetxlRange);
for i=1:size(W_read1) %324
if mod(i12)==0 %取余数
Month_index_read(i:)=[1 1 0 0];%说明训练结果是12月的
elseif mod(i12)==1
Month_index_read(i:)=[0 0 0 1];%1
elseif mod(i12)==2
Month_index_read(i:)=[0 0 1 0];%2
elseif mod(i12)==3
Month_index_read(i:)=[0 0 1 1];%3
elseif mod(i12)==4
Month_index_read(i:)=[0 1 0 0];%4
elseif mod(i12)==5
Month_index_read(i:)=[0 1 0 1];%5
elseif mod(i12)==6
Month_index_read(i:)=[0 1 1 0];%6
elseif mod(i12)==7
Month_index_read(i:)=[0 1 1 1];%7
elseif mod(i12)==7
Month_index_read(i:)=[1 0 0 0];%8
elseif mod(i12)==9
Month_index_read(i:)=[1 0 0 1];%9
elseif mod(i12)==10
Month_index_read(i:)=[1 0 1 0];%10
else
Month_index_read(i:)=[1 0 1 1];%11
end
end
Wmin=min(W_read[]1);
Wmax=max(W_read[]1);
for i=1:size(W_read1)
W_read_N(i:)=(W_read(i:)-Wmin)./(Wmax-Wmin);
end
Index_training_data_start=100;
Index_training_data_end=300;
Index_testing_data_end=324;
Training_data_N=W_read_N(Index_training_data_start:Index_training_data_end:); %归一化的训练数据
No_training_data=size(Training_data_N1);
Factors_training_lag1=[Training_data_N(12:No_training_data-1:) Month_index_read(12:No_training_data-1:)]; %前一月训练因素
Factors_training_lag12=[Training_data_N(1:No_training_data-12:) Month_index_read(1:No_training_data-12:)]; %前一年同一个月的训练因素
for i=1:No_training_data-12
Ave_training_lag12(i:)=mean(Training_data_N(i:i+111)); %前一年整年的月平均用电量
Total_training_lag12(i:)=Training_data_N(i:i+111); %前一年整年的月用电量
end
Factors_training_forecasted=[Training_data_N(13:No_training_data:) Month_index_read(13:No_training_data:)]; %用于训练的当月因素
Factors_testing_lag1=[W
评论
共有 条评论