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 Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by