Skip to content

Instantly share code, notes, and snippets.

@gdoteof
Last active September 29, 2018 18:09
Show Gist options
  • Save gdoteof/206aff2851f854f20eebf1ea1c505e73 to your computer and use it in GitHub Desktop.
Save gdoteof/206aff2851f854f20eebf1ea1c505e73 to your computer and use it in GitHub Desktop.
function output = sigmoid(incoming)
output = 1/(1+(exp(incoming * -1)))
endfunction
%question 4
Wxh=-.1
Whh=.5
Why=.25
hbias=.4
ybias=0
x0 = 18
x1 = 9
x2 = -8
h0 = .2
h1 = .4
h2 = .8
y0 = .05
y1 = .1
y2 = .2
t0 = .1
t1 = -.1
t2 = -.2
z2 = Wxh * x2 + Whh * h1 + hbias
z1 = Wxh * x1 + Whh * h0 + hbias
% E1 = 1/2 (t1 -y1)^2
e1y1 = -(t1 - y1)
% y1 = Why * h1 + ybias
y1h1 = Why
%h1 = sigmoid(z1)
h1z1 = z1 * (1 - z1)
e1z1 = e1y1 * y1h1 * h1z1
% E2 = 1/2 (t2 -y2)^2
e2y2 = -(t2 - y2)
% y2 = Why * h2 + ybias
y2h2 = Why
%h2 = sigmoid(z2)
h2z2 = z2 * (1 - z2)
%z2 = Wxh * x2 + Whh * h1 + hbias
z2h1 = Whh
e2z1 = e2y2 * y2h2 * h2z2 + z2h1 * h1z1
Ez1 = e1z1 + e2z1
display("answr to question 4")
Ez1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment