In [4]:
import numpy as np
import math
import matplotlib.pyplot as plt
%matplotlib inline
In [5]:
print ("Layer 1")
X1 = np.array ([1, 2.00, 0.26])
# Layer 2
print ("Layer2")
print ("X1 =", X1)
W12 = np.array ([[-0.18, -0.16, -0.03, -0.15],
[0.166, -0.18, 0.01, -0.06],
[0.14, -0.14, -0.065, -0.06]])
W12
print ("W12 =")
print (W12)
Y2 = X1.dot(W12)
print ("Y2 =", Y2)
A2 =1/(1+np.exp(-Y2))
print ("A2 =", A2)
In [6]:
# Layer 3
print ("Layer3")
print ("A2 =", A2)
W23 = np.array ([-1.01, -1.99, -0.25, -1.64])
print ("W23 =")
print (W23)
Y3 = A2.dot(W23)
print ("Y3 =", Y3)
h =1/(1+np.exp(-Y3))
print ("h(x) =", h)
error = 1-h
print ("e = ", error)