Fail to insert a dataset into an array.The array keeps showing that the dataset is an undefined function or variable

1 回表示 (過去 30 日間)
Hey,
I am trying to insert a default build-in dataset into a feed-forward neural network. I followed the instructions and typed
load simplefit_dataset ;
[NNInputs, NNTargets] = simplefit_dataset ;
into the Command. It used to train and display the neural network window, but now just by inserting the dataset into the array, it keeps showing the error:
??? Undefined function or variable 'simplefit_dataset'.
And if I change "simplefit_dataset" to "[0, 0]" i.e.
[NNInputs NNTargets] = simplefit_dataset ;
or the other way
[NNInputs NNTargets] = [0 0] ;
I get the error:
??? Too many output arguments.
What a trivial yet unprecedented problem which keeps annoying me for hours. Thanks in advance !

採用された回答

Image Analyst
Image Analyst 2014 年 1 月 4 日
編集済み: Image Analyst 2014 年 1 月 4 日
We don't know what got loaded. Try this:
s=load('simplefit_dataset.mat') % or whatever the actual filename of the .mat file is.
fields(s) % No semicolon to display fields into command window.
Tell us what you see.
Maybe you want
[NNInputs, NNTargets] = size(simplefit_dataset);
or
NNInputs = simplefit_dataset.NNInputs;
NNTargets = simplefit_dataset.NNTargets;
I'm not really sure until I see what you loaded and how you plan on using simplefit_dataset, NNInputs and NNTargets.
  2 件のコメント
iCeiRA
iCeiRA 2014 年 1 月 5 日
編集済み: iCeiRA 2014 年 1 月 5 日
Hi, Image Analyst !
Thank you for answering my question. I am so glad that you answer it right away!
the simplefit_dataset delivers two matrices of simplefitInputs and simpleTargets each with dimension 1 x 94 composed of "double" numbers. And yes, I am actually doing the latter operation that you mentioned by inserting the Inputs and outputs into the matrix [NNInputs, NNOutputs].
I am sorry that I can't show the datset here due to its huge piles of numbers but what I intend to do is feeding the dataset into the neural network as follows:
% Load in the data
load simplefit_dataset ; % Or load('simplefit_dataset.mat') ;
[NNInputs, NNTargets] = simplefit_dataset ;
% Create a feed-forward network with 20 neurons
net = feedforwardnet(20)
% Adjust number of layers
feedforwardnet.numlayers = 2 ;
% Train the network ;
net = train(net, NNInputs, NNTargets);
% Test the network
NNOutputs = net (NNInputs) ;
errors = gsubtract( NNTargets, NNOutputs) ;
performance = perform( net, NNTargets, NNOutputs) ;
% View the network
view( net ) ;
Oh, and by the way, when I tried to run the code yesterday on MATLAB R2010a it shows those errors, and today when I do the same on MATLAB R2012a it runs smoothly. This is kind of confusing, why is that?
My ultimate goal is to insert my own dataset with Inputs and Targets both in dimension of 2 x 100 which makes up a MIMO system. Is it possible to have multiple outputs for the NN Toolbox's neural network? (I heard it's possible with cell array but so far I've failed to do so with the older version) Once again, thank you so much!
Image Analyst
Image Analyst 2014 年 1 月 5 日
編集済み: Image Analyst 2014 年 1 月 5 日
This does not look right:
[NNInputs, NNTargets] = simplefit_dataset ;
For that to work, it would have to think that simplefit_dataset is a function (m-file, class, etc.) Since it's not, it should throw an error. It will not somehow magically dissect simplefit_dataset and stick part of it into NNInputs and stick some other part of it into NNTargets. It is not " inserting the Inputs and outputs into the matrix [NNInputs, NNOutputs]" as you said. I just can't imagine how it runs without error.
By the way, is there any reason why you didn't run the commands I first asked you to run?

サインインしてコメントする。

その他の回答 (1 件)

Greg Heath
Greg Heath 2014 年 1 月 6 日
1. In all of the nndatasets in the NNTBX, the inputs and outputs have the same number of columns.
help nndatasets
doc nndatasets
2. Therefore, it makes sense to try to use the semicolon format. However, that causes an error message that says you have to use a counterintuitive comma:
>> [ x ; t] = simplefit_dataset;
[ x ; t] = simplefit_dataset;
|
Error: Multiple left-hand sides must be separated by commas.
3. Using the counterintuitive comma works:
>> [ x , t] = simplefit_dataset; whos
Name Size Bytes Class Attributes
t 1x94 752 double
x 1x94 752 double
4. Note, however, a single output format yields
>> z = simplefit_dataset; whos, isequal(z,x)
Name Size Bytes Class Attributes
ans 1x1 1 logical
t 1x94 752 double
x 1x94 752 double
z 1x94 752 double
ans = 1
Hope this helps.
Thank you for formally accepting my answer (I'm trying to catch Image Analyst(;>) )
Greg
  2 件のコメント
Image Analyst
Image Analyst 2014 年 1 月 6 日
編集済み: Image Analyst 2014 年 1 月 6 日
I've never seen this work
[ x , t] = simplefit_dataset;
for a variable . I have for functions but not a variable. Is that some syntax that works for a special type of variable? I never use datasets, so does that syntax that works for dataset variables?
You're way ahead of everyone here in the acceptance ratio. You get an impressive 60-70% accepted (probably boosted by the fact that you're the only neural nets expert here) while the rest of use get only 20-30, so at least you have bragging rights about that.
Greg Heath
Greg Heath 2014 年 1 月 7 日
The counterintuitive comma syntax is a special syntax used for downloading the 35 data sets used in NN examples and demos:
help nndatasets
doc nndatasets
help 'any NN function'
I don't know if it is valid elsewhere.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by