dim error of dlnetwork predict

조회 수: 5 (최근 30일)
jingwen
jingwen 2024년 4월 15일
편집: Malay Agarwal 2024년 4월 23일
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
jingwen
jingwen 2024년 4월 15일
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.

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

답변 (1개)

Malay Agarwal
Malay Agarwal 2024년 4월 23일
편집: Malay Agarwal 2024년 4월 23일
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!

카테고리

Help CenterFile Exchange에서 Custom Training Loops에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by