My general question is how can I add a customized and complex loss function to neural network?
I have to address this issue ASAP, because I did not find any good examples that can do it. In the loss function documentation there is a short and simple example, but I did not succeed to expand it to more complex loss function and to implement a code that do what I want. I think I'm missing something, and I wish for a well organized tutorial for this purpose, if someone can refer to me, please.
I have one example, but I do not want to limit the answers only for this example.
So, if I have a 1D signal as an input (x), and I trained a net to get a similar 1D signal as the output (y). The network is using the default loss function (e.g. CrossEntropyLossLayer). I want to add an expression to the loss function (and sill use the CrossEntropyLossLayer in addition to it) , so it will minimize the values between two succeeding samples. For examples something like:
∑n ‖x(n+1)-x(n) ‖
This loss does not deal with y, only with x.
How can I do it ? What is the right way to customize the loss function ?
I hope someone can help me. I;m using Mathematica 11.3
Thank you very much!