- make sure net is a network object
- x should be a 4x150 double
- t should be a 3x150 double.
patternnet throwing error on iris_dataset
6 次查看(过去 30 天)
显示 更早的评论
When I run
[x,t] = iris_dataset;
net = patternnet(10);
I have no problems, but when subsequently running
net = train(net,x,t);
I get the errors below (FYI, ver gives Deep Learning Toolbox, Version 14.5, (R2022b)). I had run some third-party neural network code but am 99% sure I've removed it all from my path. This stuff worked previously. Any help would be most welcome.
Index in position 1 exceeds array bounds. Index must not exceed 1.
Error in initnw>initialize_layer (line 176)
range(inputStart(j):inputStop(j),:) = temp2((inputStart(j):inputStop(j))-inputStart(j)+1,:);
Error in initnw (line 101)
out1 = initialize_layer(in1,in2);
Error in initlay>initialize_network (line 155)
net = feval(initFcn,net,i);
Error in initlay (line 97)
out1 = initialize_network(in1);
Error in network/init (line 31)
net = feval(initFcn,net);
Error in network/configure (line 253)
net = init(net);
Error in nntraining.config (line 146)
net = configure(network(net),X,T);
Error in nntraining.setup>setupPerWorker (line 102)
[net,X,Xi,Ai,T,EW,Q,TS,err] = nntraining.config(net,X,Xi,Ai,T,EW,configNetEnable);
Error in nntraining.setup (line 77)
[net,data,tr,err] = setupPerWorker(net,trainFcn,X,Xi,Ai,T,EW,enableConfigure);
Error in network/train (line 342)
[net,data,tr,err] = nntraining.setup(net,net.trainFcn,X,Xi,Ai,T,EW,enableConfigure,isComposite);
0 个评论
回答(1 个)
Adam Danz
2023-2-9
I am unable to reproduce this error using the same release (R2022b, Deep Learing TB 14.5).
In net = train(net,x,t),
Otherwise, your inputs are not set up correctly.
4 个评论
Adam Danz
2023-2-10
We're reaching the limits of my ability to remotely troubleshoot since I cannot reproduce the problem. If you know how to work in debug mode, you can open initnw.m and put a break point on line 176 since that's where the error is happening according to the error message. This line below will open the file to that line.
matlab.desktop.editor.openAndGoToLine(fullfile(matlabroot,'\toolbox\nnet\nnet\nninitlayer\initnw.m'), 176);
Then run the steps that cause the error. The code will pause at the break point which is where you can investigate which part of that line is causing the problem. It's an indexing problem. An example of an indexing problem is
var = 4;
var(2)
If you gain any insights and need help to backtrace the problem, we can continue the discusion. Alternatively, you could contact tech support.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!