Filter löschen
Filter löschen

Implementing a Neural Network

1 Ansicht (letzte 30 Tage)
Tony Stark
Tony Stark am 25 Okt. 2022
Kommentiert: Walter Roberson am 26 Okt. 2022
I am trying to create a linear neural network that takes in 11 inputs and gives out 5 outputs.
I've been using the following documentation as reference: https://www.mathworks.com/help/deeplearning/ug/linear-neural-networks.html
Now, x is a 75 by 11 array, of inputs for the training data.
Meanwhile, y is a 5 by 75 array, of true label outputs for the training data.
So far I have tried:
P = x'
T = y
net = linearlayer;
net = configure(net,P,T);
net.IW{11,5}
net.b{1}
I am getting an error when initializing the weights, what am I doing wrong? Since there is going to be 10 inputs, I assume that there will be 11 weights. Then there should be 1 bias weight.
Overall structure is supposed to be 11 inputs for the input layer, 1 hidden layer, and an output layer of 5 outputs. (Hence, y has 5 rows. Also, hence why x has 11 columns)
I am only trying to set up the linear neural network, not at the point of training it.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 26 Okt. 2022
x = rand(75,11);
y = randi(5, 5, 75);
P = x';
T = y;
net = linearlayer;
net = configure(net,P,T);
net.IW
ans = 1×1 cell array
{5×11 double}
net.IW{1}(5,11)
ans = 0
net.b{1}
ans = 5×1
0 0 0 0 0
  2 Kommentare
Tony Stark
Tony Stark am 26 Okt. 2022
Thank you for your answer, it is really helpful. Although, since there are 11 inputs, shouldn't there be 11 weights? Why is the answer just 0?
Walter Roberson
Walter Roberson am 26 Okt. 2022
There are 11 scalar weights for each of the 5 outputs, a 5 x 11 array. Asking to look at the 11, 5 configuration is asking to look at the initialization weight for the last step for the last output, a scalar.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by