Info

This question is closed. Reopen it to edit or answer.

I am using NN in matlab to predict energy use for residential and I got this error

1 view (last 30 days)
I use matrix 8*189 as input_1 and 1*189 as output for training for testing I use 8*84 as Input_2 to predict energy consumption (Output) when I run the NN I got this message (Error Error using bsxfun Non-singleton dimensions of the two input arrays must match each other.
Error in gsubtract (line 22) c = bsxfun(@minus,a,b);
Error in Neural_Network_Taguhci_Per_Retorfit_Adel_W (line 37) e = gsubtract(t,y);
code % Solve an Input-Output Fitting problem with a Neural Network % Script generated by Neural Fitting app % Created Tue Feb 10 08:41:56 EST 2015 % % This script assumes these variables are defined: % % Input_Exp_Temp_P8x189_w - input data. % Output_Exp_Temp_P8x189_w - target data. load('Input_Exp_Temp_P8x189_w.mat') load('Output_Exp_Temp_P8x189_w.mat') load('Input_Exp_Pos_Retorfit_W_P8x84.mat') x = Input_Exp_Temp_P8x189_w; t = Output_Exp_Temp_P8x189_w; Test=Input_Exp_Pos_Retorfit_W_P8x84
% Choose a Training Function % For a list of all training functions type: help nntrain % 'trainlm' is usually fastest. % 'trainbr' takes longer but may be better for challenging problems. % 'trainscg' uses less memory. NFTOOL falls back to this in low memory situations. trainFcn = 'trainlm'; % Levenberg-Marquardt
% Create a Fitting Network hiddenLayerSize = 10; net = fitnet(hiddenLayerSize,trainFcn);
% Setup Division of Data for Training, Validation, Testing net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100;
% Train the Network [net,tr] = train(net,x,t);
% Test the Network y = net(Test); e = gsubtract(t,y); performance = perform(net,t,y)
% View the Network view(net)
% Plots % Uncomment these lines to enable various plots. %figure, plotperform(tr) %figure, plottrainstate(tr) %figure, plotfit(net,x,t) %figure, plotregression(t,y) %figure, ploterrhist(e)
  1 Comment
adel naji
adel naji on 12 Feb 2015
Thanks for your answer but I have Target(; t = Output_Exp_Temp_P8x189_w) the input and output for training are x = Input_Exp_Temp_P8x189_w; t = Output_Exp_Temp_P8x189_w; The input for testing Test=Input_Exp_Pos_Retorfit_W_P8x84 So I am try to find the Output (predict energy use) for test

Answers (1)

Greg Heath
Greg Heath on 11 Feb 2015
length(t) = 189
length(y) = length(Test)= 84 ~= 189
You do not have the target for Test. Therefore, you cannot quantify the prediction performance.
Hope this helps.
Thank you for formally accepting my answer
Greg
  2 Comments
adel naji
adel naji on 12 Feb 2015
Thanks for your answer but I have Target(; t = Output_Exp_Temp_P8x189_w) the input and output for training are x = Input_Exp_Temp_P8x189_w; t = Output_Exp_Temp_P8x189_w; The input for testing Test=Input_Exp_Pos_Retorfit_W_P8x84 So I am try to find the Output (predict energy use) for test
Greg Heath
Greg Heath on 12 Feb 2015
MATLAB default terminology includes the test subset as 15% of the original data. Additional data should not also use the modifier test. I prefer the modifier "new".
You have new 84-D inputs that yield new 84-D outputs. HOWEVER, you do not know the corresponding new 84-D targets. Therefore, you can neither calculate the corresponding new 84-D error nor it's performance value.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!