Training neural network - Forward Pass

조회 수: 6 (최근 30일)
Gautami Golani
Gautami Golani 2019년 4월 1일
답변: Greg Heath 2019년 4월 3일
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

답변 (1개)

Greg Heath
Greg Heath 2019년 4월 3일
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

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by