Error in predicted outputs for labels in neural network

1 vue (au cours des 30 derniers jours)
Tony Stark
Tony Stark le 26 Oct 2022
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.

Réponses (1)

Amanjit Dulai
Amanjit Dulai le 27 Oct 2022
Modifié(e) : Walter Roberson le 20 Nov 2022
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);

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by