MATLAB Answers

1

Loss function in CNN

Asked by Andres Ramirez on 9 Aug 2019
Latest activity Answered by Matt J
on 9 Aug 2019
I am trying to define a custom classification output layer in which I am defining the cross entropy as an error function. To my error function I want to add a second function whose error depends on the input and output of two intermediate layers of the CNN, but I have no idea how to extract these two variables to include them in the error function.
Could someone please help me.
Thank you.
Greetings.

  0 Comments

Sign in to comment.

1 Answer

Matt J
Answer by Matt J
on 9 Aug 2019

I expect you might have to feed the hidden layer outputs forward, making them inputs/outputs of your custom output layer. That way, you can then treat the hidden layers just like any other output layer prediction variables.
Doing this would result in an imperfectly sequential network architecture. The following page on layerGraph objects shows how to take control of the architecture at this level.

  0 Comments

Sign in to comment.