Use multidimensional (n>2) array as input for train

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 个评论

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.
That's exactly my problem: my input doesn't have the required number of dimensions. 35 is the number of samples. Each sample is a two-dimensional array (1440 values in the first dimension, with each 19 associated values in the second dimension). The current datatype in which I store it is a 3-dimensional array of unit8 (as the values are all between 0 and 100). The question is on how to convert this 3-dimensional array into the required format.

请先登录,再进行评论。

 采纳的回答

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 个评论

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?
Yes, and if the net is not a classifier, PCA should work

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by