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.

댓글을 달려면 로그인하십시오.

 채택된 답변

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

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에 대해 자세히 알아보기

질문:

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