Error in predicted outputs for labels in neural network

2 ビュー (過去 30 日間)
Tony Stark
Tony Stark 2022 年 10 月 26 日
編集済み: Walter Roberson 2022 年 11 月 20 日
I am having trouble trying to diagnose why my neural network is not working. I tried modifying the code since my last post. However, I am still stuck.
The following is the whole modified code:
clc;
clear;
x = rand(75,11);
y = randi(5, 5, 75);
P = x';
T = y;
net = linearlayer;
net = configure(net,P,T);
net.trainParam.epochs = 1000;
[net,tr] = train(net,P,T);
view(net)
y_labels = net(P);
The following is the code that is meant as the data. Where x is the input data, and y is the target/label data.
clc;
clear;
x = rand(75,11);
y = randi(5, 5, 75);
The following is the code that is meant to configure the linear neural network model and train the model:
P = x';
T = y;
net = linearlayer;
net = configure(net,P,T);
net.trainParam.epochs = 1000;
[net,tr] = train(net,P,T);
view(net)
The following is the code that is meant to predict the target data outputs:
y_labels = net(P);
Now for the variable, y_labels, I get all 0s, which is different from the true original y data. It's not even close. I would appreciate some guidance. I went on MATLAB documentation to see if there is anything that would help modify, but nothing has been helping.

回答 (1 件)

Amanjit Dulai
Amanjit Dulai 2022 年 10 月 27 日
編集済み: Walter Roberson 2022 年 11 月 20 日
As mentioned here: https://uk.mathworks.com/matlabcentral/answers/1835423-what-s-wrong-with-my-neural-network#answer_1085378 the training will work better when the learning rate is reduced:
x = rand(75,11);
y = randi(5, 5, 75);
P = x';
T = y;
% Set the learning rate to 0.001
net = linearlayer(0,0.001);
net = configure(net,P,T);
net = train(net,P,T);

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by