Backward Propagation and Hinge Loss

조회 수: 3 (최근 30일)
Saugata Bose
Saugata Bose 2019년 7월 3일
Hi
I plan to write a function which will output the derivative of a hinge loss w.r.t the ground truth. I consider the function as following from this link:
X66bj.png+
where as Y(the first parameter)is the prediction and Y.(the second parameter) is the ground truth.
During calcualting bakward loss, what I understand is, I need to calcualte the derivative of the above loss w.r.t the second paramter, right? In that case, will the code be like following:
function dLdX = backwardLoss1( this, Y, T )
% backwardLoss Back propagate the derivative of the loss
% function
%
% Syntax:
% dLdX = layer.backwardLoss( Y, T );
%
% Image Inputs:
% Y Predictions made by network, 1-by-1-by-numClasses-by-numObs
% T Targets (actual values), 1-by-1-by-numClasses-by-numObs
%
% Vector Inputs:
% Y Predictions made by network, numClasses-by-numObs-by-seqLength
% T Targets (actual values), numClasses-by-numObs-by-seqLength
if(Y*T<1)
dLdX=-T/size(Y);
else
dLdX=0;
end
end
But following this link, it's diplaying the calculation of the derivative w.r.t the parameters which makes me confuse that shuld I need to output the los w.rt the weights as well as w.r.t to the ground truth?
I am looking for your suggestions in this reagrd.
thanks,

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by