neural network regression model error

1 回表示 (過去 30 日間)
aman hari
aman hari 2019 年 7 月 14 日
回答済み: Divya Gaddipati 2019 年 7 月 17 日
i used the following data to generate a dataset nd to train the network as shown but is getting the following error can someone help why this error comes
x = rand(1000,1);
y = sin(x)
options = trainingOptions('adam','Plots','training-progress','MaxEpochs',100)
net = trainNetwork(transpose(x),transpose(y),layers_1,options);
ERROR:
Training on single CPU.
|========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | RMSE | Loss | Rate |
|========================================================================================|
Error using trainNetwork (line 165)
To RESHAPE the number of elements must not change.
Caused by:
Error using reshape
To RESHAPE the number of elements must not change.
Network MODEL:
Capture.JPG

回答 (1 件)

Divya Gaddipati
Divya Gaddipati 2019 年 7 月 17 日
As I understand, your input dataset, “x” has size 1000 x 1 and the output, “y” has size 1000 x 1 and you are defining a regression model for predicting “y”.
In your model, the number of neurons in the last FC layer should match the dimension of “y”. Since, your output is 1-dimensional, the output size of the last Fully Connected (FC) layer used should also be 1. In case, your output “y” is of size 1000 x 2, then the output size of the FC layer should be 2.

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by