I am using matlab r2010a to design a neural network to model 13,440 samples of numeral data of 3 input variables and 1 target. When i try to train, i get the following message;Targets are incorrectly sized for network. Matrix must have 3 columns

The following is the code i have used;
Data_Inputs = xlsread('tvdiary10080.xlsx'); Testing_Data = xlsread('tvdiary3360.xlsx'); Shuffling_Inputs = Data_Inputs(randperm(10080),1:4); Training_Set = Shuffling_Inputs(1:10080,1:3)% specify training set [1st - 21st] Target_Set = Shuffling_Inputs(1:10080,4) % specify target set [22nd – 28th] Testing_Set = Testing_Data(1:3360,1:3) % specify Testing set [1st - 21st] Testing_Target_Set = Testing_Data(1:3360,4) % specify Testing set, Target [22nd – 28th] [pn, ps] = mapstd(Training_Set); [tn, ts] = mapstd(Target_Set); MyNetwork = newff (pn,tn, [20] , {'logsig'}); MyNetwork.trainFcn = 'trainlm'; MyNetwork.trainparam.min_grad = 0.00000001; MyNetwork.trainParam.epochs = 1000; MyNetwork.trainParam.lr = 0.4; MyNetwork.trainParam.max_fail =20; %MyNetwork= newrb(pn,tn,goal,spread, mn, df); MyNetwork = train(MyNetwork,pn,tn); save(NetworkName,'MyNetwork'); y = sim(MyNetwork, testn); % simulate network y_again = mapstd('reverse',y, targets) % denormlized %Daily_Result = performance(y,t,'all', 'v') % calculate statstics
What am i doing wrong?

 采纳的回答

1. Learn how to format your submissions e.g., indent equations 1 space
2. Transpose your matrices (as explained in the documentation)
Thank you for formally accepting my answer
Greg

1 个评论

Thanks Greg and sorry for the casual submission. But if i add the transpose apostrophe, the response i get is this;
>> [pn, ps] = mapstd(Training_Set.’); ??? [pn, ps] = mapstd(Training_Set.’); | Error: The input character is not valid in MATLAB statements or expressions.
>> [pn, ps] = mapstd(Training_Set ’); ??? [pn, ps] = mapstd(Training_Set ’); | Error: The input character is not valid in MATLAB statements or expressions.
>> [pn, ps] = mapstd(Training_Set’); [tn, ts] = mapstd(Target_Set’); ??? [pn, ps] = mapstd(Training_Set’); | Error: The input character is not valid in MATLAB statements or expressions.

请先登录,再进行评论。

更多回答(1 个)

I just discovered where i was going wrong! To transpose, the apostrophe on the laptop keyboard is not recognizable by Matlab. I had to copy a more straight one from the net and it was accepted;
- rejected.
' - accepted

类别

帮助中心File Exchange 中查找有关 Deep Learning Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by