Do I need the derivative of loss function at every layer for a customized loss function?
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I am very new to use the neural network toolbox in matlab, I am trying to implement my own customized loss function but my loss function is complicated. My question is, is there any easy way to build my neural network other than determining the derivative of my loss function at every layer in my network, or determining once is enough?
Regards,
Jubeyer
0 个评论
回答(1 个)
Raunak Gupta
2019-11-18
Hi,
In my understanding for define custom loss function you need to change the last layer of the model which can be a classificationLayer or a regressionLayer. For defining custom loss function, you need to declare a custom layer which required declaring forward loss and backward loss for backpropagation. So, if calculation of derivative of the loss function is feasible you may declare that in backwardLoss otherwise you may only declare the forwardLoss using the functions that supports dlarray.
Calculating the derivative of loss at each layer for backpropagation is not required as only last layer is the one which is using something custom. For defining the custom layers for different problem statements, you may refer to the following. Note that for using above functions you require Deep Learning Toolbox also.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!