Error in predicted outputs for labels in neural network

2 Ansichten (letzte 30 Tage)
Tony Stark
Tony Stark am 26 Okt. 2022
Bearbeitet: Walter Roberson am 20 Nov. 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.

Antworten (1)

Amanjit Dulai
Amanjit Dulai am 27 Okt. 2022
Bearbeitet: Walter Roberson am 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);

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by