before we beginthe mathematical building blocks of neural networks the engine of neural networksgradient-based optimization as you saw in the previous sectioneach neural layer from our first network example transforms its input data as followsoutput relu(dot(winputbin this expressionw and are tensors that are attributes of the layer they're called the weights or trainable parameters of the layer (the kernel and bias attributesrespectivelythese weights contain the information learned by the network from exposure to training data initiallythese weight matrices are filled with small random values ( step called random initializationof coursethere' no reason to expect that relu(dot(winputb)when and are randomwill yield any useful representations the resulting representations are meaningless--but they're starting point what comes next is to gradually adjust these weightsbased on feedback signal this gradual adjustmentalso called trainingis basically the learning that machine learning is all about this happens within what' called training loopwhich works as follows repeat these steps in loopas long as necessary draw batch of training samples and corresponding targets run the network on ( step called the forward passto obtain predictions y_pred compute the loss of the network on the batcha measure of the mismatch between y_pred and update all weights of the network in way that slightly reduces the loss on this batch you'll eventually end up with network that has very low loss on its training dataa low mismatch between predictions y_pred and expected targets the network has "learnedto map its inputs to correct targets from afarit may look like magicbut when you reduce it to elementary stepsit turns out to be simple step sounds easy enough--just / code steps and are merely the application of handful of tensor operationsso you could implement these steps purely from what you learned in the previous section the difficult part is step updating the network' weights given an individual weight coefficient in the networkhow can you compute whether the coefficient should be increased or decreasedand by how muchone naive solution would be to freeze all weights in the network except the one scalar coefficient being consideredand try different values for this coefficient let' say the initial value of the coefficient is after the forward pass on batch of datathe loss of the network on the batch is if you change the coefficient' value to and rerun the forward passthe loss increases to but if you lower the coefficient to the loss falls to in this caseit seems that updating the coefficient by - licensed to