Azzera filtri
Azzera filtri

dim error of dlnetwork predict

3 visualizzazioni (ultimi 30 giorni)
jingwen
jingwen il 15 Apr 2024
Modificato: Malay Agarwal il 23 Apr 2024
Hello everyone, I am a newbie in matlab. I encountered a very basic problem, but I really don't know how to solve it.
The problem statement is as follows:
My input dlx is 1(C)*13(B)*685(T) dlarray, this means it has 685 time and each time has 13 features. And the "net" dlnetwork is sequence to label, label is 2 classes. I hope output is 2*685, however is 2*13 dlarray.
Please tell me what is my problem?
Thank you very much for coming to see my question and wish you a happy life
Y_predicted = predict(net, dlx);
  1 Commento
jingwen
jingwen il 15 Apr 2024
And the input and output when training the net is
xx= cell(685, 1);
for i = 1:685
rowData = X(i, :);
xx{i} = rowData';
end
yy=categorical(Y);
and X is 685*13 and Y is 685*1.

Accedi per commentare.

Risposte (1)

Malay Agarwal
Malay Agarwal il 23 Apr 2024
Modificato: Malay Agarwal il 23 Apr 2024
I understand that you have trained a sequence neural network to classify samples into one of two classes and were expecting the output to have a different dimension when using the “predict” function on the network.
Please note that the dimension the “predict” function outputs is the expected dimension since your dataset is , meaning there are 13 data points or samples, with each data point having 685 time steps. The model is classifying each of the 13 samples into one of the two classes, resulting in the output.
The following link provides more information regarding the terms samples, time steps and channels (or features): https://stats.stackexchange.com/questions/264546/difference-between-samples-time-steps-and-features-in-neural-network#:~:text=I%20found%20this,per%20time%20step.
If you would like to train a network which classifies each time step into one of the two classes, please consider the following example and modify it accordingly: https://www.mathworks.com/help/deeplearning/ug/sequence-to-sequence-classification-using-deep-learning.html.
Please note that even the above example will not exactly match your expected output since the trained network will classify each time step of each sample into one of the two classes, resulting in 13 instances of dimensional outputs.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by