Forecasting problem forecastload error
Mostra commenti meno recenti
I guys i would like to know if somebody could help with this, i am trying to forecast the load of a certain house in a year. i am using neuronal networks to do this, first i loaded my data and generated a predictors matrix as indicated below then i use that matriz and the load of the actual one to train the the neuronal network. then i created a test set with only one week to do a forecast. But when i try to run this, it keeps giving me the same error over and over.Plz help. Thank you for your attention.
Error:
Subscripted assignment dimension mismatch.
Error in fixunknowns.apply (line 17) y((1:settings.xrows) + settings.shift,:) = x;
Error in nnMATLAB.pc (line 28) pi = hints.inp(i).procApply{j}(pi,hints.inp(i).procSet{j});
Error in nncalc.preCalcData (line 20) data.Pc = calcMode.pc(net,data.X,data.Xi,data.Q,data.TS,calcHints);
Error in nncalc.setup1 (line 118) calcData = nncalc.preCalcData(matlabMode,matlabHints,net,data,doPc,doPd,calcHints.doFlattenTime);
Error in network/sim (line 283) [calcMode,calcNet,calcData,calcHints,~,resourceText] = nncalc.setup1(calcMode,net,data);
Error in LoadScriptNN (line 70) forecastLoad = sim(net,testX);
CODE:
%% Split the dataset to create a Training and Test set % The dataset is divided into two sets, a training set which includes % data from 2004 to 2007 and a test set with data from 2008. The training % set is used for building the model (estimating its parameters). The test % set is used only for forecasting to test the performance of the model on % out-of-sample data.
% Create training set trainInd = data.semana < 54; trainX = transpose(X(trainInd,:)); trainY = transpose(data.carga(trainInd));
% Create test set and save for later testInd = data.semana == 3; testX = transpose(X(testInd,:)); testY = transpose(data.carga(testInd)); % testDates = dates(testInd);
save Data\testSet testX testY
clear X data trainInd testInd term holidays dates ans num text
%% Initialize and Train Network % Initialize a default network of two layers with 20 neurons. Use the "mean % absolute error" (MAE) performance metric. Then, train the network with % the default Levenburg-Marquardt algorithm. For efficiency a pre-trained % network is loaded unless a retrain is specifically enforced.
reTrain = false; if reTrain ~exist('Models\NNModel.mat', 'file') net = newfit(trainX, trainY, 20); net.performFcn = 'mae'; net = train(net, trainX, trainY); save Models\NNModel.mat net else load Models\NNModel.mat end
%% Forecast using Neural Network Model % Once the model is built, perform a forecast on the independent test set.
load Data\testSet
forecastLoad = sim(net,testX);
1 Commento
Greg Heath
il 26 Mag 2014
Reformat with no more than 1 command per line
What are the sizes of your matrices?
Risposte (0)
Categorie
Scopri di più su Deep Learning Toolbox in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!