Question: II: Consider the following code. a). Fill in the blanks and test the code. b). What is the output of the code. (1) Import numpy
(1) Import numpy using alias "p" below: def nonline, der i False): IF(deriv=True): return x*(1-x) return 1/(1+np.exp(-x)) X = np.array([[0,0,1). [0,1,1). (1,0,1). [1,1,1]]) y = np.array([], [0]) np.randos. seed (1) randomly initialize our weights with mean syne = 2 p.random.random((2,4)) - 1 syni - 2nprandon.random((4,1)) - 1 For ) in range(69000): Feed forward through Layers O, 1. and 2 10 x 11 - nonlin(np. dot (10, syne) 12 - nonlin(np.dot(11, syni)) (2) what is the difference between y and y-hat? 12 error = (a) print 12 error in every 10000 iterations print("Error: + strinpeas (np.abs(12 errors) In What direction is the target value were we really sure? If so, don't change too much 12_delta 12 error onlin(12, deriveTrue how much did each 11 value contribute to the 12 cror(according to the we 11 error - 12 delta.dat (sy2.1) in what direction is the target 117 were we really sure if 19, don't change too much 11 delta 11 error onlinli, derivire synl - 11. T.dot (12. deita) syno le.T.dot ( 11 delta) (4) print bothy and y.bat
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
