len(xnum_epochs print (epoch batch loss"print ("for epoch in range ( num_epochs + )batch_idx np random choice (nbatch_size batch_x xbatch_idx reshape - , batch_y =ybatch_idx reshape - , dc_dw dc_db loss backward ( , ,batch_x batch_y d_beta list vec (dc_dw dc_db loss_arr append (loss flatten ([ ]ifepoch == or np mod(epoch , == )print (epoch ,"",loss flatten ([ ]beta beta lrd_beta , vec list (beta ,pcalculate the loss of the entire training set dc_dw dc_db loss backward ( , , ,yprint (entire training set loss ",loss flatten ([ ]xx np arange ( , , y_preds np zeros_like (xxfor in range (len(xx))a__ feedforward (xx[ ], ,by_preds [ ] [lplt plot( , ' 'markersize label ' 'plt plot(np array (xx)y_preds ' ',label 'fit 'plt legend (plt xlabel (' 'plt ylabel (' 'plt show (plt plot(np array loss_arr )' 'plt xlabel ('iteration 'plt ylabel ('training loss 'plt show (epoch batch loss entire training set loss the left panel of figure shows trained neural network with training loss of approximately as seen from the right panel of figure the algorithm initially makes rapid progress until it settles down into stationary regime after iterations