Network with custom defined Regression Layer Output
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Srivardhan Gadila
2020년 9월 30일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Build Deep Neural Networks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!