필터 지우기
필터 지우기

Hand input data to custom loss function in a regression neural network

조회 수: 2 (최근 30일)
Rebecca Plant
Rebecca Plant 2021년 11월 2일
댓글: Marcos 2024년 1월 25일
I'm building an LSTM deep neural network for sequence-to-one regression and need to implement a custom loss function for training. The issue is that my loss function depends on the input data X that I feed to the network. I'm running out of ideas how to properly hand the input data to the output layer. For custom regression output layers there seems to be no way to use the NN input data X as an input to the loss function. Also, I tried adding the input data to the target data array T, but then the size of T doesn't match the expected format compared to the NN output. Does anyone know how I can properly implement this?
  댓글 수: 2
Rebecca Plant
Rebecca Plant 2021년 11월 8일
In case someone else is struggling with this in the future:
I found a workaround by using
X = evalin('base','nnDataIn');
to import the input data (nnDataIn) from the base workspace to the loss function. For what I know the evalin function is not the best coding style, but it worked fine for me.
Marcos
Marcos 2024년 1월 25일
Hi Rebecca, do you remember how you did this? Where did you use evalin?
Thank you!

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by