Use multidimensional (n>2) array as input for train
1 view (last 30 days)
Show older comments
I would like to train a neural network for unsupervised clustering. I have 35 samples. Each sample is a 2-dimensional uint8-array, i.e. "input" is a < 35x1440x19 uint8 > array.
Using the sample from the "train" documentation I get:
% Create a Self-Organizing Map
dimension1 = 10;
dimension2 = 10;
net = selforgmap([dimension1 dimension2]);
% Train the Network
[net,tr] = train(net,input);
Error using nntraining.setup (line 13)
Inputs X is not two-dimensional.
Error in network/train (line 247)
[net,data,tr,err] = nntraining.setup(net,net.trainFcn,X,Xi,Ai,T,EW,true);
How do I convert "input" into a variable which "train" will accept? Any help would be appreciated.
2 Comments
Greg Heath
on 26 Feb 2014
This explanation makes no sense to me. The input should contain N I-dimensional vector examples with
[ I N ] = size(input);
Please explain what each of 35, 1440 and 19 represent.
Accepted Answer
Greg Heath
on 26 Feb 2014
1. Convert the data to format long
2. Use PCA feature extraction to reduce IROW = 1440 to irow << IROW
3. Columnize using (:) to get I = 19*irow for the N = 35 examples
4. Nomenclature: The 35 examples constitute one sample
2 Comments
Image Analyst
on 8 Mar 2014
Lorenzo's "Answer" moved here:
Columnizing was a good advice, thanks. However, I think in this way some information will get missed (relation between the two dimensions). Dimension reduction (e.g. by PCA) is always a solution, however whether PCA is the right one might depend on the data type. Recution of the example size is good to avoid getting out of memory.
If I get it right then, the answer to my question would be: having examples with more than one dimenstion (i.e. samples with more than 2 dimensions) is not possible with "train", the dimensions must be reduced first?
More Answers (0)
See Also
Categories
Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!