In [9]:
import numpy as np
import math
import matplotlib.pyplot as plt
%matplotlib inline
In [10]:
print ("Layer 1")
X1 = np.array ([1, 2.00, 0.26])
# Layer 2
print ("Layer2")
print ("X1 =", X1)
W12 = np.array ([[12.70, -.20, -.74, -.19],
[-1.49, -8.85, 7.08, -8.29],
[-19.85, -2.61, -3.59, -2.70]])
W12
print ("W12 =")
print (W12)
Y2 = X1.dot(W12)
print ("Y2 =", Y2)
A2 =1/(1+np.exp(-Y2))
print ("A2 =", A2)
In [11]:
# Layer 3
print ("Layer3")
print ("A2 =", A2)
W23 = np.array ([7.44,2.78,-4.31,-2.70])
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)
In [ ]: