Clear Filters
Clear Filters

Backward Propagation and Hinge Loss

2 views (last 30 days)
Saugata Bose
Saugata Bose on 3 Jul 2019
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,

Answers (0)

Community Treasure Hunt

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

Start Hunting!