Network with custom defined Regression Layer Output
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello everybody, I'm having problems creating a neural network.
Basically, my network has one input and one output; however I have no target, but the output will be fed into a library which approximates numerically a PDE and returns a vector such that I can interpret the loss function as the sum of the elements of this vector.
From my understanding of https://it.mathworks.com/help/deeplearning/ug/define-custom-regression-output-layer.html I am able to define an output layer with my specific loss function, defining in this template the following loss function:
function loss = forwardLoss(layer,Y)
% loss = forwardLoss(layer, Y) returns the loss function
% exploiting the predictions Y.
e = C_main2D('Test1',Y);
loss = sum(e);
end
The idea would be to have a vector of inputs in order to train the network by using the trainNetwork function, but the problem arises when I get to the definition of the Layer array.
I get that the regression layer I have defined should be the last element, but I don't understand how to properly define the layers in order to be able to pass the vector of inputs, a couple of hidden layers and then the regression output layer.
Thanks in advance for helping me.
0 comentarios
Respuestas (1)
Srivardhan Gadila
el 30 de Sept. de 2020
As per my knowledge and above information, I think using the custom training loop would be a good Idea. You can refer to Train Network Using Custom Training Loop & Deep Learning Custom Training Loops for more information.
Ver también
Categorías
Más información sobre Build Deep Neural Networks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!