Training neural network - Forward Pass

5 visualizaciones (últimos 30 días)
Gautami Golani
Gautami Golani el 1 de Abr. de 2019
Respondida: Greg Heath el 3 de Abr. de 2019
I have written a code for forward pass of neural network with the following inputs and targets as shown in the code below. A bias is also present and there is one hidden layer (with 2 neurons) and one output layer.
I am not sure whether the code I have written is correct. Could someone tell me if my logic is correct?
X = [0 0; 0 1];
D = [0;1];
X = [ones(1,2); X];
w1 = [0.15, 0.1, 0.3];
w2 = [-0.05, -0.2,-0.25];
w3 = [0.1,0.2, -0.3];
lr = 1;
H = 2;
No = 1;
max_iter = 10;
for iter = 1:max_iter
for j=1:H %Forward Pass
inpH1 = (w1*X);
outH1 = logsig(inpH1);
inpH2 = (w2*X);
outH2 = logsig(inpH2);
output = [ones(1,2); outH1; outH2];
end
for k=1:No
inpO = w3*output;
out_layer = logsig(inpO);
end
Error = 0.5*(D-out_layer').^2
end

Respuestas (1)

Greg Heath
Greg Heath el 3 de Abr. de 2019
You are very mixed up. I suggest going to the library and finding a good elementary NN book.
Obviously, the appropriate info is available online. However, you will have to search and/or get help from elsewhere.
Sorry,
Greg

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by