Problem with feedforwardnet function: not enough input arguments
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jon Cherrie
2021-4-21
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.
回答(1 个)
Adam Danz
2020-10-17
编辑:Adam Danz
2020-10-17
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
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!