필터 지우기
필터 지우기

RMSE of sequences in cell arrays with different length

조회 수: 1 (최근 30일)
sotiraw sotiroglou
sotiraw sotiroglou 2019년 4월 3일
답변: Star Strider 2019년 4월 19일
In the Sequence-to-Sequence Regression Using Deep Learning example the rmse is caclulated this way
for i = 1:numel(YTest)
YTestLast(i) = YTest{i}(end);
YPredLast(i) = YPred{i}(end);
end
figure
rmse = sqrt(mean((YPredLast - YTestLast).^2))
in this case we are interested only on the last element so YPredLast - YTestLast is one to one element substraction
IN the general case that i am interested on the whole output sequence, what will be the substraction??
YTest - Ypred cannot be performed as these are cell arrays.
how can we calculate the rmse from the whole sequencies?
  댓글 수: 2
madhan ravi
madhan ravi 2019년 4월 3일
편집: madhan ravi 2019년 4월 3일
You use (i) and you say it’s a cell array ?? No sign of pre-allocation whatsoever.
sotiraw sotiroglou
sotiraw sotiroglou 2019년 4월 19일
Please read more carefully the questions before you write your answers..
The code provided on the example is for a specific example , where the Ytest is a cell array. And YtestLast is not a cell array. So Ytest is a cell array and i am asking how to caclulate rmse on Ytest, if we are interested on a simular example that we do not only want the last element of it, but the whole sequence. I hope this answers to you question???
As for the pre-allocation , i just used an official matlab example. And their code , do you have any comment on the question i ask? thanks

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

답변 (1개)

Star Strider
Star Strider 2019년 4월 19일
I am not certain what final result you want.
This should get you started:
subt = cellfun(@minus, YTest, YPred, 'Uni',0); % Vector Differences
RMSE = cellfun(@(x)sqrt(mean(x.^2)), subt, 'Uni',0); % RMSE Of Vector Differences
You can use the cell2mat function to convert the ‘RMSE’ vector to a double vector, and then do any other necessary calculations on it.
Experiment to get the result you want.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by