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 件のコメント

Greg Heath
Greg Heath 2014 年 2 月 26 日
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.
Lorenzo
Lorenzo 2014 年 2 月 26 日
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.

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

 採用された回答

Greg Heath
Greg Heath 2014 年 2 月 26 日

1 投票

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 件のコメント

Image Analyst
Image Analyst 2014 年 3 月 8 日
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?
Greg Heath
Greg Heath 2014 年 3 月 8 日
Yes, and if the net is not a classifier, PCA should work

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

質問済み:

2014 年 2 月 25 日

コメント済み:

2014 年 3 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by