Deep Learning Toolbox: Layer 'regressionoutput': Detected output layer. The network must not have output layers.

58 views (last 30 days)
Hello,
I am using the Deep Learning Toolbox with a predefined example from the documentation, for a regression problem:
numFeatures = 15;
numResponses = 10;
numHiddenUnits = 100;
layers = [
sequenceInputLayer(numFeatures)
lstmLayer(numHiddenUnits,OutputMode="last")
fullyConnectedLayer(numResponses)
regressionLayer];
dlnet = dlnetwork(layers);
I cannot find any cause for it and I didn't find any suggestions online regarding this. I just want to test a simple STFT layer with a vector inputs of a certain fixed length.
Error using dlnetwork/initialize
Invalid network.
Error in dlnetwork (line 218)
net = initialize(net, dlX{:});
Error in test_stft_layer (line 37)
dlnet = dlnetwork(layers);
Caused by:
Layer 'regressionoutput': Detected output layer. The network must not have output layers.

Accepted Answer

Sai Kiran
Sai Kiran on 9 Mar 2023
Hi,
The regressionLayer is not supported in dlnetwork, you have to define custom loss function if you use the dlnetwork. Please refer to the following example on workflow for dlnetwork.
Please refer to the following example on how to implement regression using LSTM in MATLAB.
I hope it helps!
Thanks.
  2 Comments
Mircea Susca
Mircea Susca on 10 Mar 2023
Thank you very much! I didn't know why it's not acceptable in this case; I'll investigate the indicated examples and adapt accordingly.
Imrana
Imrana on 23 Jan 2024
I have a question here, how do we apply lstm network to irregular data. Are we able to use neuralODELayer but then it throws an error "invalid Network"?
Can you please help me out with any example?
Best Regards,
Imrana

Sign in to comment.

More Answers (0)

Categories

Find more on Image Data Workflows in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!