output of neural network changes

조회 수: 2 (최근 30일)
giacomo baccolo
giacomo baccolo 2021년 4월 20일
답변: Shashank Gupta 2021년 4월 26일
Hi everyone,
I have trained a LSTM neural network to classify some sequences. The sequence length is 50 and the number of classes is 4.
I tried the network to classify a new set of data for an external validation of the network perfomances.
I noticed that the classifications change depending on how I feed the network.
I tried two approach:
to feed the network with all the data in one time
to feed the network one sample at a time within a for loop
YPred_val1 = classify(net,X_valN);
for i = 1:size(X_valN,2)
YPred_val2(i) = classify(net,X_valN(:,i));
end
I thought the results would be identical (I expected YPred_val1 equal to YPred_val2) in the two tries but actually the classifications are different, about the 50% of the samples has a different predicted label comparing the results.
do you have any idea why? maybe I m missing something?
Many thanks
Giacomo

채택된 답변

Shashank Gupta
Shashank Gupta 2021년 4월 26일
Hi,
It won't be necessarily identical, since you are dealing with LSTM network which means the testing data is sequencial in nature, so if each time step given as input to trained network will not be necessarily give same output as compared to giving all seqeunces at one time because of LSTM behaviour. The second approach which you tried will consider each time stamp as independent identity while the first approach where each time stamp is connected to previous timestamp. If its a general CNN network then sure both the result will be identical.
I hope my explaination make sense.
Cheers.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by