-Hg|ddlZddlZGddeZdZdZddZdZdZ d Z d Z d Z e d k(r egd Zyy)NceZdZdZy)NetworkcDt||_||_|ddDcgc]"}tjj |d$c}|_t|dd|ddDcgc]%\}}tjj ||'c}}|_ycc}wcc}}w)N) lenlayerssizesnprandomrandnbiaseszipweights)selfr yxs d/Users/aayushbajaj/Documents/new-site/static/code/10khrs-ai-ml-dl/learning/nielsen-dl/ch1_network.py__init__zNetwork.__init__se*DKDJ38)<)Q299??1a()dllG:TU:TB!SZ(",,:TU$,9 activation activationszsrdeltalsps rr<r<2s(, 4 1RXXagg  ' 4(, 5 1RXXagg  ' 5*+ "$++t||,da q*!AIIaLJz" -   {2 2]2b65J J%'"+uk"o779:'"+ DOO $a A2A q B FF4<<1%//15 9B >EGQBK&& QBqD 1 ; ; =>GQBK % 7 - 5 5s &G&Gc |Dcgc]+\}}tj|j||f-}}}td|DScc}}w)zReturn the number of test inputs for which the neural network outputs the correct result. Note that the neural network's output is assumed to be the index of whichever neuron in the final layer has the highest activation.'c3>K|]\}}t||k(ywN)int).0rrs r zevaluate..Ps 4|VaSa[|s)r argmaxr%sum)rr1rr test_resultss rr,r,MsJDMNI&1a299T--a0115I,N 4| 4 44Os0A c ||z S)z^Return the vector of partial derivatives 'partial C_x / partial a' for the output activations.r)routput_activationsrs rrIrIRs q !rc6t|dt|z zS)Nr)rrs rrJrJVs Qwqz\ ""r__main__)rGrrU)numpyr r objectrrr%r8r)r<r,rIrJrnetrrrrds[ RfR" * T65 "# z#r