Do I need the derivative of loss function at every layer for a customized loss function?

1 visualización (últimos 30 días)
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

Respuestas (1)

Raunak Gupta
Raunak Gupta el 18 de Nov. de 2019
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.

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by