Backward Propagation and Hinge Loss
3 views (last 30 days)
Show older comments
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:
+
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 Comments
Answers (0)
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!