1D Regression with CNN
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
João M. Lopes
el 17 de Mzo. de 2020
Comentada: Hiro Yoshino
el 1 de Jun. de 2020
How should I treat my input matrix and target matrix for 1D regression problem with CNN?
Suppose I have EMG signals with 760000 points (samples) and I've collected data from 8 muscles (features). So, I have a matrix 760000-by-8. My target is a matrix 760000-by-1. Imagine that I have 1 trial for each 5 persons. So, I'll have for each person a 760000-by-8 matrix.
1)
In the documentation, it says that CNN treats the input data as an image, so it expects an input like h-by-w-by-c-by-N.
In this case, should I consider my features as the number of channels or the width of my input "image"? And N should be 5?
I.e., should I rearrage my training data as 760000-by-1-by-8-by-5 or 760000-by-8-by-1-by-5? Reading the documentation e some questions about this issue, I do not fully understand how should I give my data to the trainNetwork function.
2)
Another question is about the fully connected layer after the CNN feature extractor layers. After I have my feature maps, as this is a regression problem and my target is a 760000-by-1 signal, the output size of my fully connected layer should be 760000?
I'm always having a size issue, saying that it is required a very long array and matlab would become unresponsive.
Thanks in advance
0 comentarios
Respuesta aceptada
Hiro Yoshino
el 17 de Mzo. de 2020
I skimmed through the issue - sorry if I am answering in a different direction.
You should convert the 1D data into image format as follows:
X_train = reshape(X_train', [1, 1, size(X_train,2), size(X_train,1)]);
X_train: 100 x 4 matrix meaning 100 samples x 4 features
Then you should use imageInputLayer as follows:
nFeatures = 4;
nHiddenUnits1 = 3;
nHiddenUnits2 = 3; % num of classes
nClasses = 3;
layers = [
imageInputLayer([1 1, nFeatures],"Name","imageinput") % この指定の仕方も最重要ポイント 2
fullyConnectedLayer(nHiddenUnits1,"Name","fc_1")
fullyConnectedLayer(nHiddenUnits2,"Name","fc_2")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
Hope this helps you out.
3 comentarios
aybike pirol elmas
el 31 de Mayo de 2020
Hi,
similar problem.
my EMG data 2x174800 (so 2 input or channels) and target 1x174800. I will predict, not classification
The output size of my fully connected layer should be 174800?how will this be?
Hiro Yoshino
el 1 de Jun. de 2020
You may want to set the output number of the fullyconnectedlayer before the regression layer, which should be deployed at the end of the network, as 174800.
Más respuestas (0)
Ver también
Categorías
Más información sobre AI for Signals en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!