Problem with feedforwardnet function: not enough input arguments

3 visualizzazioni (ultimi 30 giorni)
I've been having recently some problems when creating neural networks on matlab. Basicaly, I cannot create a simple net due to the following problem: "not enough input arguments".
Previously it worked just fine. I used nntool and nnstart in order to create some backpropagation nets or the feedforwardnet function without any problem. But now, by just writting net=feedforwardnet or net=feedforwardnet("number of hidden layers") the software answers me with the previous message. I uninstalled and reinstalled the software in order to see if magically the problem would be fixed. And surprisingly it worked... for a day. So I don't know what else can I do, I hope someone could help me to solve this weird problem.
The complete outcome of matlab is the following:
>> net=feedforwardnet(2); (2 hidden layers for example)
Not enough input arguments.
Error in mse (line 2)
mseValue = mean((ytrue-ypred).^2,"omitnan");
Error in network>new_network (line 142)
net.performParam = mse('defaultParam');
Error in network (line 71)
net = new_network(varargin{:});
Error in feedforwardnet>create_network (line 105)
net = network;
Error in feedforwardnet (line 73)
net = create_network(param);
  2 Commenti
Jon Cherrie
Jon Cherrie il 21 Apr 2021
I wonder if you have another version of the mse function on your path in MATLAB.
To check, try this command:
which -all mse
When I try this, I get
>> which mse -all
C:\Program Files\MATLAB\R2021a\toolbox\nnet\nnet\nnperformance\mse.m
C:\Program Files\MATLAB\R2021a\toolbox\nnet\deep\@dlarray\mse.m % dlarray method
If you see an extra function listed then that might be getting called instead of the nnet version. Hence the error you see.
Sarmed Wahab
Sarmed Wahab il 16 Lug 2022
Have you figured out the soluton, I am getting the same error.

Accedi per commentare.

Risposte (1)

Adam Danz
Adam Danz il 17 Ott 2020
Modificato: Adam Danz il 17 Ott 2020
Going all the way back to Matlab r2015b (the earliest version that provides access to documentation), feedforwardnet has always been defined with two inputs.
What release were you using that allowed you to use 0 or 1 input? Are you sure you weren't using a 3rd party function not provided by Matlab?
Update:
Now that I've had a chance to poke around in feedforwardnet.m, I notice that the function can receive 1 or even 0 inputs but this is not documented. Typically when inputs are optional the Matlab documentation will appear as below but this is either undocumented or inconsistent. When I try the function with 0 or 1 input in r2020b, I do not get an error.
Syntax
net = feedforwardnet blah blah blah blah
net = feedforwardnet(hiddenSizes) blah blah blah blah
net = feedforwardnet(hiddenSizes,trainFcn) blah blah blah blah
  2 Commenti
Pedro Gilabert
Pedro Gilabert il 17 Ott 2020
Modificato: Pedro Gilabert il 17 Ott 2020
Yeah, the function is feedforwardnet('hiddenSizes','trainFcn') which hiddenSizzes refers to the number of neurons in the hidden layers and trainFcn refers to the training mode that the net will use.
But, in the case that you don't especify those values the program assumes as default 10 hidden neurons and trainlm as the training process.
And I am pretty sure that I am using MATLAB R2020B from the beginning.
Adam Danz
Adam Danz il 17 Ott 2020
Modificato: Adam Danz il 19 Ott 2020
I've updated my answer.
When I try the function with r2020b with 1 input I do not get an error.
To check your matlab version, look at the top of the main command window or use ver().
Please share the entire error message.

Accedi per commentare.

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by