patternnet throwing error on iris_dataset

3 Ansichten (letzte 30 Tage)
Steve
Steve am 9 Feb. 2023
Kommentiert: Adam Danz am 10 Feb. 2023
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);

Antworten (1)

Adam Danz
Adam Danz am 9 Feb. 2023
I am unable to reproduce this error using the same release (R2022b, Deep Learing TB 14.5).
In net = train(net,x,t),
  1. make sure net is a network object
  2. x should be a 4x150 double
  3. t should be a 3x150 double.
Otherwise, your inputs are not set up correctly.
  4 Kommentare
Steve
Steve am 9 Feb. 2023
Bearbeitet: Steve am 9 Feb. 2023
>> which('patternnet')
/Applications/MATLAB_R2022b.app/toolbox/nnet/nnet/nnnetwork/patternnet.m
>> which('train')
/Applications/MATLAB_R2022b.app/toolbox/nnet/nnet/@network/train.m % network method
I removed the 3rd party code from the path interactively and put it in the trash--it's not getting called.
Adam Danz
Adam Danz am 10 Feb. 2023
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)
Index exceeds the number of array elements. Index must not exceed 1.

'var' appears to be both a function and a variable. If this is unintentional, use 'clear var' to remove the variable 'var' from the workspace.
If you gain any insights and need help to backtrace the problem, we can continue the discusion. Alternatively, you could contact tech support.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by