{"id":16882,"date":"2026-07-19T19:37:03","date_gmt":"2026-07-19T19:37:03","guid":{"rendered":"https:\/\/techtrendfeed.com\/?p=16882"},"modified":"2026-07-19T19:37:03","modified_gmt":"2026-07-19T19:37:03","slug":"backpropagation-defined-for-newcomers-half-1-constructing-the-instinct","status":"publish","type":"post","link":"https:\/\/techtrendfeed.com\/?p=16882","title":{"rendered":"Backpropagation Defined for Newcomers (Half 1): Constructing the Instinct"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p class=\"wp-block-paragraph\"> to know backpropagation?<\/p>\n<p class=\"wp-block-paragraph\">If you happen to\u2019re making an attempt to know how trendy AI techniques like giant language fashions (LLMs) are skilled, backpropagation is among the most necessary ideas to know.<\/p>\n<p class=\"wp-block-paragraph\">However should you ask me how I felt once I encountered it, I used to be utterly misplaced by wanting on the math equations. It felt like a psychological block for me.<\/p>\n<p class=\"wp-block-paragraph\">I noticed and needed to start out from scratch and construct my understanding one step at a time.<\/p>\n<p class=\"wp-block-paragraph\">That journey started with my <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/neural-networks-explained-for-beginners-start-here-if-theyve-confused-you\/\">earlier article<\/a>, the place we constructed a neural community from scratch utilizing a easy dataset and understood the way it makes predictions.<\/p>\n<p class=\"wp-block-paragraph\">The weblog acquired an important response. Thanks for that!<\/p>\n<p class=\"wp-block-paragraph\">Now, let\u2019s proceed with the identical method. We&#8217;ll break down backpropagation step-by-step, protecting it as easy and intuitive as earlier than.<\/p>\n<p class=\"wp-block-paragraph\">Earlier than we start, I simply wish to say one factor. We\u2019ll take this one step at a time. <\/p>\n<p class=\"wp-block-paragraph\">Matters like backpropagation can really feel overwhelming at first, however as soon as we construct a robust basis, all the pieces else turns into a lot simpler to know. <\/p>\n<p class=\"wp-block-paragraph\">So, let\u2019s get began.<\/p>\n<hr class=\"wp-block-separator has-text-color has-blue-gray-color has-alpha-channel-opacity has-blue-gray-background-color has-background is-style-dotted\"\/>\n<p class=\"wp-block-paragraph\">Welcome again!<\/p>\n<p class=\"wp-block-paragraph\">Let\u2019s proceed our studying journey via deep studying.<\/p>\n<p class=\"wp-block-paragraph\">We have already got a fundamental understanding of neural networks, which we explored utilizing a easy dataset within the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/neural-networks-explained-for-beginners-start-here-if-theyve-confused-you\/\">earlier weblog<\/a>.<\/p>\n<p class=\"wp-block-paragraph\">Now, let\u2019s first recall what we discovered within the earlier weblog on neural networks.<\/p>\n<h3 class=\"wp-block-heading\">Fast Recap<\/h3>\n<p class=\"wp-block-paragraph\">We thought of this straightforward dataset.<\/p>\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2026\/07\/backpropagation-blog.png\" alt=\"\" class=\"wp-image-673084\"\/><figcaption class=\"wp-element-caption\">Picture by Creator<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">After plotting the info, it regarded like this:<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2026\/06\/exam_scores_scatter-1024x826.png\" alt=\"\" class=\"wp-image-668154\"\/><figcaption class=\"wp-element-caption\">Picture by Creator<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">We noticed {that a} single line was not sufficient to suit it. So, we determined to resolve it utilizing neural networks.<\/p>\n<p class=\"wp-block-paragraph\">Subsequent, we obtained to know in regards to the equation of a single neuron, and after that, we discovered in regards to the completely different layers in a neural community.<\/p>\n<p class=\"wp-block-paragraph\">For simplicity, we thought of one hidden layer with two hidden neurons.<\/p>\n<p class=\"wp-block-paragraph\">Subsequent, we noticed how the 2 hidden neurons produced two completely different linear transformations, after which we needed to mix them within the output layer.<\/p>\n<p class=\"wp-block-paragraph\">Nonetheless, we discovered that combining two strains produced one other line, not the curve that would match the info. <\/p>\n<p class=\"wp-block-paragraph\">That is the place we realized the importance of activation features, as they introduce non-linearity into the mannequin.<\/p>\n<p class=\"wp-block-paragraph\">So, we handed the outputs from the hidden neurons via the activation operate (ReLU) after which mixed them within the output layer. <\/p>\n<p class=\"wp-block-paragraph\">In different phrases, we took the linear mixture of the outputs from the activation operate within the output layer, and at last, we obtained the curve.<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2026\/06\/final_neural_network_output-1024x609.png\" alt=\"\" class=\"wp-image-668378\"\/><figcaption class=\"wp-element-caption\">Picture by Creator<\/figcaption><\/figure>\n<hr class=\"wp-block-separator has-text-color has-text-link-color has-alpha-channel-opacity has-text-link-background-color has-background is-style-dotted\"\/>\n<p class=\"wp-block-paragraph\">Within the earlier weblog we constructed the neural community structure and noticed the way it makes predictions via ahead propagation.<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2026\/06\/NEURAL-NETWORKS-11.png\" alt=\"\" class=\"wp-image-668372\"\/><figcaption class=\"wp-element-caption\">Picture by Creator<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">Earlier than we learn the way backpropagation works, let\u2019s first take a look at the values produced at every layer in the course of the ahead cross which we mentioned in earlier weblog. <\/p>\n<p class=\"wp-block-paragraph\">We\u2019ll use these values all through the weblog to know how the community learns by updating its parameters.<\/p>\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2026\/07\/backpropagation-blog-1-1024x358.png\" alt=\"\" class=\"wp-image-673086\"\/><figcaption class=\"wp-element-caption\">Picture by Creator<\/figcaption><\/figure>\n<hr class=\"wp-block-separator has-text-color has-blue-gray-color has-alpha-channel-opacity has-blue-gray-background-color has-background is-style-dotted\"\/>\n<h3 class=\"wp-block-heading\">Why Does the Community Have to Study?<\/h3>\n<p class=\"wp-block-paragraph\">After we take a look at the ultimate curve produced by our neural community, we are able to see that it&#8217;s not a great match. <\/p>\n<p class=\"wp-block-paragraph\">For instance, when the hours studied (x) is 1, the precise examination rating is 55, however our neural community predicts it as 28, which is a large distinction.<\/p>\n<p class=\"wp-block-paragraph\">Now, we have to make our neural community carry out higher, which suggests it ought to predict values which might be a lot nearer to the precise examination scores. <\/p>\n<p class=\"wp-block-paragraph\">To do this, the neural community must study. By studying, we imply determining which parameters needs to be elevated and which needs to be decreased to cut back the loss.<\/p>\n<hr class=\"wp-block-separator has-text-color has-blue-gray-color has-alpha-channel-opacity has-blue-gray-background-color has-background is-style-dotted\"\/>\n<h3 class=\"wp-block-heading\">Studying from a Acquainted Instance<\/h3>\n<p class=\"wp-block-paragraph\">Now, how can we do that?<\/p>\n<p class=\"wp-block-paragraph\">At this level, we don\u2019t know the way to try this.<\/p>\n<p class=\"wp-block-paragraph\">Let\u2019s do one factor. Let\u2019s proceed with what we already know.<\/p>\n<p class=\"wp-block-paragraph\">However what will we already know?<\/p>\n<p class=\"wp-block-paragraph\">We have already got an concept about easy linear regression, how the loss is calculated, and the way the bowl curve seems.<\/p>\n<p class=\"wp-block-paragraph\">Perhaps we are able to study one thing from it.<\/p>\n<p class=\"wp-block-paragraph\">In easy linear regression, we have to discover the optimum values for \u03b20 (intercept) and \u03b21 (slope).<\/p>\n<p class=\"wp-block-paragraph\">After all, we have already got formulation, however we additionally derived them ourselves.<\/p>\n<p class=\"wp-block-paragraph\">What we did was plot a graph with three axes. One axis represented (\u03b20), the second represented (\u03b21), and the third represented the loss.<\/p>\n<p class=\"wp-block-paragraph\">We plotted the loss values for various (\u03b20) and (\u03b21) values and noticed a bowl-shaped curve. <\/p>\n<p class=\"wp-block-paragraph\">We then understood that the minimal loss happens on the backside of the curve, the place the slope of the loss floor turns into zero.<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2026\/07\/loss_surface-1002x1024.png\" alt=\"\" class=\"wp-image-673127\"\/><figcaption class=\"wp-element-caption\">Picture by Creator<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">To seek out that time, we used partial differentiation and finally solved the ensuing equations to acquire the formulation.<\/p>\n<p class=\"wp-block-paragraph\">In easy linear regression, we are able to use completely different loss features such because the Sum of Squared Errors (SSE), Imply Squared Error (MSE), or different appropriate loss features relying on the issue.<\/p>\n<p class=\"wp-block-paragraph\">Right here, we\u2019ll contemplate the Imply Squared Error (MSE) as our loss operate.<\/p>\n<p class=\"wp-block-paragraph\">For easy linear regression, the loss operate is<\/p>\n<p class=\"wp-block-shortcode\">[<br \/>L(beta_0,beta_1)=frac{1}{n}sum_{i=1}^{n}left(y_i-hat{y}_iright)^2<br \/>]<\/p>\n<p>the place<\/p>\n<p>[<br \/>\nhat{y}_i=beta_0+beta_1x_i.<br \/>\n]<\/p>\n<p>Discover that the loss relies upon solely on two parameters, [beta_0] and [beta_1]<\/p>\n<p>Now we have to search out the values of [beta_0] and [beta_1] that decrease this loss.<\/p>\n<p>Now, let\u2019s take a look at our neural community.<\/p>\n<p>Since our present drawback is a non-linear regression drawback, we are able to proceed utilizing the identical Imply Squared Error (MSE).<\/p>\n<p>The loss operate can now be written as<\/p>\n<p>[<br \/>\nL(w_1,w_2,w_3,w_4,b_1,b_2,b_3)<br \/>\n=<br \/>\nfrac{1}{n}<br \/>\nsum_{i=1}^{n}<br \/>\nleft(y_i-hat{y}_iright)^2.<br \/>\n]<\/p>\n<p>Nonetheless, in contrast to easy linear regression, our prediction is now not given by<\/p>\n<p>[<br \/>\nhat{y}=beta_0+beta_1x.<br \/>\n]<\/p>\n<p>As an alternative, it&#8217;s produced by the complete neural community.<\/p>\n<p>For our neural community,<\/p>\n<p>[<br \/>\nhat{y}_i<br \/>\n=<br \/>\nw_3,mathrm{ReLU}(w_1x_i+b_1)<br \/>\n+<br \/>\nw_4,mathrm{ReLU}(w_2x_i+b_2)<br \/>\n+<br \/>\nb_3.<br \/>\n]<\/p>\n<p>Consequently, the loss now not is dependent upon simply two parameters. It now is dependent upon all seven parameters of the neural community, that are [w_1,w_2,w_3,w_4,b_1,b_2,b_3]<\/p>\n<p>Similar to in easy linear regression, our purpose continues to be the identical: discover the values of those parameters that decrease the loss.<\/p>\n<p>To realize that, we have to perceive how the loss modifications after we change every parameter individually whereas protecting the remaining parameters fastened.<\/p>\n<p>In different phrases, we have to compute partial derivatives equivalent to<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1},<br \/>\nquad<br \/>\nfrac{partial L}{partial w_2},<br \/>\nquad<br \/>\nfrac{partial L}{partial w_3},<br \/>\nquad<br \/>\nldots,<br \/>\nquad<br \/>\nfrac{partial L}{partial b_3}.<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">These partial derivatives inform us how delicate the loss is to every parameter and assist us decide whether or not that parameter needs to be elevated or decreased to cut back the loss.<\/p>\n<hr class=\"wp-block-separator has-text-color has-blue-gray-color has-alpha-channel-opacity has-blue-gray-background-color has-background is-style-dotted\"\/>\n<h3 class=\"wp-block-heading\">Setting the Purpose<\/h3>\n<p class=\"wp-block-paragraph\">In easy linear regression, after we plot the loss values for various combos of the slope and intercept, we get a bowl-shaped curve in three-dimensional house.<\/p>\n<p class=\"wp-block-paragraph\">For our neural community, nonetheless, we can&#8217;t visualize the loss floor in the identical means as a result of it now exists in eight-dimensional house. <\/p>\n<p class=\"wp-block-paragraph\">Although we are able to\u2019t visualize it, our goal stays the identical which is to search out the parameter values that decrease the loss.<\/p>\n<hr class=\"wp-block-separator has-text-color has-blue-gray-color has-alpha-channel-opacity has-blue-gray-background-color has-background is-style-dotted\"\/>\n<h3 class=\"wp-block-heading\">Time to Perceive Chain Rule<\/h3>\n<p class=\"wp-block-paragraph\">Now, primarily based on what we already know from easy linear regression, we discovered a method to proceed additional, which is to compute the partial derivatives of the loss with respect to every parameter.<\/p>\n<p class=\"wp-block-paragraph\">The parameters are <\/p>\n<p class=\"wp-block-shortcode\">[w_1,w_2,w_3,w_4,b_1,b_2,b_3]<\/p>\n<p class=\"wp-block-paragraph\">However earlier than we proceed, there&#8217;s one necessary idea that we have to perceive, and that&#8217;s the <strong>chain rule<\/strong> as a result of it&#8217;s the basis of all the pieces we\u2019re going to do subsequent.<\/p>\n<p class=\"wp-block-paragraph\">The chain rule is used every time one amount is dependent upon one other amount, which in flip is dependent upon one other amount.<\/p>\n<p class=\"wp-block-paragraph\">Let\u2019s perceive this with a easy instance.<\/p>\n<p class=\"wp-block-shortcode\">Suppose<\/p>\n<p>[<br \/>\ny=x^2<br \/>\n]<\/p>\n<p>and<\/p>\n<p>[<br \/>\nz=y^3<br \/>\n]<\/p>\n<p>Now, we wish to discover<\/p>\n<p>[<br \/>\nfrac{dz}{dx}<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">First, let\u2019s discover this spinoff utilizing classical differentiation.<\/p>\n<p class=\"wp-block-shortcode\">Discover that [z] is written by way of [y] not [x] Since we wish the spinoff with respect to [x] we are able to first remove the intermediate variable by substituting [y=x^2] into the equation for [z]<\/p>\n<p>Substituting,<\/p>\n<p>[<br \/>\nz=(x^2)^3=x^6<br \/>\n]<\/p>\n<p>Now the expression relies upon solely on [x] so we are able to differentiate it immediately.<\/p>\n<p>Utilizing the ability rule,<\/p>\n<p>[<br \/>\nfrac{dz}{dx}<br \/>\n=<br \/>\nfrac{d}{dx}(x^6)<br \/>\n=<br \/>\n6x^5<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">This methodology could be straightforward for easy issues like this one as a result of we are able to simply substitute one expression into one other.<\/p>\n<p class=\"wp-block-paragraph\">Nonetheless, think about a a lot greater expression with a number of intermediate variables. <\/p>\n<p class=\"wp-block-paragraph\">Rewriting the complete equation earlier than differentiating would turn out to be troublesome and there&#8217;s a larger probability for errors.<\/p>\n<p class=\"wp-block-paragraph\">As an alternative of mixing all the pieces right into a single expression first, we now have a way more systematic method known as the <strong>chain rule<\/strong>. <\/p>\n<p class=\"wp-block-paragraph\">As an alternative of eliminating the intermediate variables, with the chain rule we are able to work via them one step at a time.<\/p>\n<p class=\"wp-block-paragraph\">Let\u2019s see how we are able to implement chain rule.<\/p>\n<p class=\"wp-block-shortcode\">We already know that, [frac{dz}{dx}] tells us how a lot [z] modifications after we make a really small change in [x]<\/p>\n<p>Right here [z] doesn&#8217;t rely immediately on [x]<\/p>\n<p>As an alternative, the connection seems like this:<\/p>\n<p>[<br \/>\nx rightarrow y rightarrow z.<br \/>\n]<\/p>\n<p>Which means that every time [x] modifications, it first modifications [y] and that change in [y] then modifications [z]<\/p>\n<p>Now as a substitute of making an attempt to distinguish all the pieces directly, the chain rule tells us to interrupt the issue into smaller items.<\/p>\n<p>[<br \/>\nfrac{dz}{dx}=frac{dz}{dy}timesfrac{dy}{dx}<br \/>\n]<\/p>\n<p>Now let\u2019s calculate every half individually.<\/p>\n<p>Since<\/p>\n<p>[<br \/>\nz=y^3,<br \/>\n]<\/p>\n<p>we get<\/p>\n<p>[<br \/>\nfrac{dz}{dy}=3y^2.<br \/>\n]<\/p>\n<p>Equally, since<\/p>\n<p>[<br \/>\ny=x^2,<br \/>\n]<\/p>\n<p>we get<\/p>\n<p>[<br \/>\nfrac{dy}{dx}=2x.<br \/>\n]<\/p>\n<p>Multiplying these collectively,<\/p>\n<p>[<br \/>\nfrac{dz}{dx}=3y^2times2x.<br \/>\n]<\/p>\n<p>Lastly, we all know that<\/p>\n<p>[<br \/>\ny=x^2,<br \/>\n]<\/p>\n<p>so we substitute it again into the equation.<\/p>\n<p>[<br \/>\nfrac{dz}{dx}=3(x^2)^2times2x=6x^5.<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">The necessary factor we are able to observe right here is that we by no means differentiated the complete expression at a time.<\/p>\n<p class=\"wp-block-paragraph\">As an alternative, we broke it into smaller derivatives, solved them one after the other, after which multiplied them collectively.<\/p>\n<p class=\"wp-block-paragraph\">We\u2019ll use precisely the identical concept in our neural community.<\/p>\n<p class=\"wp-block-paragraph\">The one distinction is that the chain is now a bit of longer.<\/p>\n<hr class=\"wp-block-separator has-text-color has-blue-gray-color has-alpha-channel-opacity has-blue-gray-background-color has-background is-style-dotted\"\/>\n<h3 class=\"wp-block-heading\">Fixing step-by-step utilizing Classical Differentiation Technique<\/h3>\n<p class=\"wp-block-paragraph\">Now that we perceive the chain rule, let\u2019s proceed to calculate the partial derivatives with respect to every parameter.<\/p>\n<p class=\"wp-block-paragraph\">Till now, we used particular values for the weights and biases to know how the ahead cross works. Nonetheless, our goal is to study these values from the info.<\/p>\n<p class=\"wp-block-paragraph\">So, as a substitute of utilizing fastened values, let\u2019s characterize them utilizing parameters first.<\/p>\n<p class=\"wp-block-paragraph\">The output of our neural community is given by<\/p>\n<p class=\"wp-block-shortcode\">[<br \/>hat{y}=w_3a_1+w_4a_2+b_3<br \/>]<\/p>\n<p>the place<\/p>\n<p>[<br \/>\na_1=mathrm{ReLU}(z_1)<br \/>\n]<br \/>\n[<br \/>\nz_1=w_1x+b_1<br \/>\n]<\/p>\n<p>and<\/p>\n<p>[<br \/>\na_2=mathrm{ReLU}(z_2)<br \/>\n]<br \/>\n[<br \/>\nz_2=w_2x+b_2<br \/>\n]<\/p>\n<p>Utilizing this output, we are able to calculate the Imply Squared Error (MSE), which is the loss operate of our neural community.<\/p>\n<p>The final MSE equation is<\/p>\n<p>[<br \/>\nL(w_1,w_2,w_3,w_4,b_1,b_2,b_3)=frac{1}{n}sum_{i=1}^{n}(y_i-hat{y}_i)^2<br \/>\n]<\/p>\n<p>Now, let\u2019s substitute the prediction equation into the loss operate.<\/p>\n<p>[<br \/>\nL(w_1,w_2,w_3,w_4,b_1,b_2,b_3)=frac{1}{n}sum_{i=1}^{n}left(y_i-left(w_3a_{1i}+w_4a_{2i}+b_3right)right)^2<br \/>\n]<\/p>\n<p>Since<\/p>\n<p>[<br \/>\na_{1i}=mathrm{ReLU}(w_1x_i+b_1)<br \/>\n]<\/p>\n<p>and<\/p>\n<p>[<br \/>\na_{2i}=mathrm{ReLU}(w_2x_i+b_2)<br \/>\n]<\/p>\n<p>the entire loss operate turns into<\/p>\n<p>[<br \/>\nL(w_1,w_2,w_3,w_4,b_1,b_2,b_3)=frac{1}{n}sum_{i=1}^{n}left(y_i-left(w_3mathrm{ReLU}(w_1x_i+b_1)+w_4mathrm{ReLU}(w_2x_i+b_2)+b_3right)right)^2<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">Now, let\u2019s begin discovering the partial spinoff with respect to any one of many parameters, let\u2019s start with<\/p>\n<p class=\"wp-block-shortcode\">[w_1]<\/p>\n<p class=\"wp-block-paragraph\">So, we now have to calculate<\/p>\n<p class=\"wp-block-shortcode\">[<br \/>frac{partial}{partial w_1}left[frac{1}{n}sum_{i=1}^{n}left(y_i-left(w_3,mathrm{ReLU}(w_1x_i+b_1)+w_4,mathrm{ReLU}(w_2x_i+b_2)+b_3right)right)^2right]<br \/>]<\/p>\n<p class=\"wp-block-paragraph\">This equation appears troublesome to resolve. How can we discover the partial spinoff with respect to<\/p>\n<p class=\"wp-block-shortcode\">[w_1]<\/p>\n<p class=\"wp-block-paragraph\">from such a big equation?<\/p>\n<p class=\"wp-block-paragraph\">Let\u2019s proceed utilizing the identical concepts from differentiation that we already know.<\/p>\n<p class=\"wp-block-shortcode\">As an alternative of differentiating all the pieces directly, we\u2019ll simplify the issue step-by-step.<\/p>\n<p>We wish to compute<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n]<\/p>\n<p>Substitute the loss operate into the spinoff.<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\nfrac{partial}{partial w_1}<br \/>\nleft(<br \/>\nfrac{1}{n}<br \/>\nsum_{i=1}^{n}<br \/>\n(y_i-hat{y}_i)^2<br \/>\nright)<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">Discover that we don&#8217;t substitute the total expression for <\/p>\n<p class=\"wp-block-shortcode\">[hat{y}_i]<\/p>\n<p class=\"wp-block-paragraph\"> but. We&#8217;ll try this solely when it turns into needed.<\/p>\n<p class=\"wp-block-shortcode\">As [frac{1}{n}] is a continuing, we all know that it may be moved outdoors the spinoff.<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\nfrac{1}{n}<br \/>\nfrac{partial}{partial w_1}<br \/>\nleft(<br \/>\nsum_{i=1}^{n}<br \/>\n(y_i-hat{y}_i)^2<br \/>\nright)<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">The summation can also be linear, so the spinoff can cross via it.<\/p>\n<p class=\"wp-block-paragraph\">What will we imply by that?<\/p>\n<p class=\"wp-block-paragraph\">It means in summation we add many phrases collectively and we are able to differentiate every time period individually after which add the derivatives.<\/p>\n<p class=\"wp-block-shortcode\">[<br \/>frac{partial L}{partial w_1}<br \/>=<br \/>frac{1}{n}<br \/>sum_{i=1}^{n}<br \/>frac{partial}{partial w_1}<br \/>left(<br \/>(y_i-hat{y}_i)^2<br \/>right)<br \/>]<\/p>\n<p>Now Differentiate the Sq.<\/p>\n<p>Let<\/p>\n<p>[<br \/>\nA=y_i-hat{y}_i<br \/>\n]<\/p>\n<p>Then<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\nfrac{1}{n}<br \/>\nsum_{i=1}^{n}<br \/>\nfrac{partial}{partial w_1}(A^2)<br \/>\n]<\/p>\n<p>Utilizing the ability rule,<\/p>\n<p>[<br \/>\nfrac{partial}{partial w_1}(A^2)<br \/>\n=<br \/>\n2A<br \/>\nfrac{partial A}{partial w_1}<br \/>\n]<\/p>\n<p>Substitute this into the earlier equation.<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\nfrac{2}{n}<br \/>\nsum_{i=1}^{n}<br \/>\nA<br \/>\nfrac{partial A}{partial w_1}<br \/>\n]<\/p>\n<p>Substitute [A] with [y_i-hat{y}_i].<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\nfrac{2}{n}<br \/>\nsum_{i=1}^{n}<br \/>\n(y_i-hat{y}_i)<br \/>\nfrac{partial}{partial w_1}<br \/>\n(y_i-hat{y}_i)<br \/>\n]<\/p>\n<p>Differentiate the Expression Inside<\/p>\n<p>We all know that the true goal (precise statement) [y_i] is a continuing,<\/p>\n<p>[<br \/>\nfrac{partial y_i}{partial w_1}=0<br \/>\n]<\/p>\n<p>Subsequently,<\/p>\n<p>[<br \/>\nfrac{partial}{partial w_1}<br \/>\n(y_i-hat{y}_i)<br \/>\n=<br \/>\n-frac{partialhat{y}_i}{partial w_1}<br \/>\n]<\/p>\n<p>Substitute this again.<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\n-frac{2}{n}<br \/>\nsum_{i=1}^{n}<br \/>\n(y_i-hat{y}_i)<br \/>\nfrac{partialhat{y}_i}{partial w_1}<br \/>\n]<\/p>\n<p>Now Differentiating the Prediction [frac{partialhat{y}_i}{partial w_1}<br \/>]<\/p>\n<p>We all know that from the output layer in our neural community<\/p>\n<p>[<br \/>\nhat{y}_i<br \/>\n=<br \/>\nw_3a_{1i}<br \/>\n+<br \/>\nw_4a_{2i}<br \/>\n+<br \/>\nb_3<br \/>\n]<\/p>\n<p>Substitute the equations of hidden neuron activation features.<\/p>\n<p>[<br \/>\nhat{y}_i<br \/>\n=<br \/>\nw_3mathrm{ReLU}(w_1x_i+b_1)<br \/>\n+<br \/>\nw_4mathrm{ReLU}(w_2x_i+b_2)<br \/>\n+<br \/>\nb_3<br \/>\n]<\/p>\n<p>Differentiate with respect to [w_1]<\/p>\n<p>[<br \/>\nfrac{partialhat{y}_i}{partial w_1}<br \/>\n=<br \/>\nfrac{partial}{partial w_1}<br \/>\nleft(<br \/>\nw_3mathrm{ReLU}(w_1x_i+b_1)<br \/>\n+<br \/>\nw_4mathrm{ReLU}(w_2x_i+b_2)<br \/>\n+<br \/>\nb_3<br \/>\nright)<br \/>\n]<\/p>\n<p>Differentiating every time period individually.<\/p>\n<p>As [w_3] is fixed,<\/p>\n<p>[<br \/>\nfrac{partial}{partial w_1}<br \/>\nleft(<br \/>\nw_3mathrm{ReLU}(w_1x_i+b_1)<br \/>\nright)<br \/>\n=<br \/>\nw_3<br \/>\nfrac{partial}{partial w_1}<br \/>\nmathrm{ReLU}(w_1x_i+b_1)<br \/>\n]<\/p>\n<p>The second time period accommodates solely [w_2] so<\/p>\n<p>[<br \/>\nfrac{partial}{partial w_1}<br \/>\nleft(<br \/>\nw_4mathrm{ReLU}(w_2x_i+b_2)<br \/>\nright)<br \/>\n=0<br \/>\n]<\/p>\n<p>Additionally,<\/p>\n<p>[<br \/>\nfrac{partial b_3}{partial w_1}=0<br \/>\n]<\/p>\n<p>Therefore,<\/p>\n<p>[<br \/>\nfrac{partialhat{y}_i}{partial w_1}<br \/>\n=<br \/>\nw_3<br \/>\nfrac{partial}{partial w_1}<br \/>\nmathrm{ReLU}(w_1x_i+b_1)<br \/>\n]<\/p>\n<p>Differentiate the ReLU Expression<\/p>\n<p>Let<\/p>\n<p>[<br \/>\nu=w_1x_i+b_1<br \/>\n]<\/p>\n<p>Then<\/p>\n<p>[<br \/>\nmathrm{ReLU}(w_1x_i+b_1)<br \/>\n=<br \/>\nmathrm{ReLU}(u)<br \/>\n]<\/p>\n<p>Now Differentiating<\/p>\n<p>[<br \/>\nu=w_1x_i+b_1<br \/>\n]<\/p>\n<p>with respect to [w_1]<\/p>\n<p>[<br \/>\nfrac{du}{dw_1}=x_i<br \/>\n]<\/p>\n<p>Now differentiate the activation.<\/p>\n<p>[<br \/>\nfrac{d,mathrm{ReLU}(u)}{du}<br \/>\n=<br \/>\nmathrm{ReLU}'(u)<br \/>\n]<\/p>\n<p>Right here we use the chain rule,<\/p>\n<p>[<br \/>\nfrac{partial}{partial w_1}<br \/>\nmathrm{ReLU}(w_1x_i+b_1)<br \/>\n=<br \/>\nmathrm{ReLU}'(u)<br \/>\nfrac{du}{dw_1}<br \/>\n]<\/p>\n<p>Substituting [frac{du}{dw_1}=x_i]<\/p>\n<p>[<br \/>\nfrac{partial}{partial w_1}<br \/>\nmathrm{ReLU}(w_1x_i+b_1)<br \/>\n=<br \/>\nmathrm{ReLU}'(u)x_i<br \/>\n]<\/p>\n<p>Changing [u]<\/p>\n<p>[<br \/>\nfrac{partial}{partial w_1}<br \/>\nmathrm{ReLU}(w_1x_i+b_1)<br \/>\n=<br \/>\nmathrm{ReLU}'(w_1x_i+b_1)x_i<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">This ReLU derivation would possibly get complicated, let\u2019s decelerate and see what we really did right here.<\/p>\n<p class=\"wp-block-paragraph\">We all know that the ReLU activation doesn\u2019t depend upon <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1<\/annotation><\/semantics><\/math> immediately. <\/p>\n<p class=\"wp-block-paragraph\">It is dependent upon the worth of <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><msub><mi>x<\/mi><mi>i<\/mi><\/msub><mo>+<\/mo><msub><mi>b<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1x_i+b_1<\/annotation><\/semantics><\/math>\u200b. <\/p>\n<p class=\"wp-block-paragraph\">On the similar time, the expression <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><msub><mi>x<\/mi><mi>i<\/mi><\/msub><mo>+<\/mo><msub><mi>b<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1x_i+b_1<\/annotation><\/semantics><\/math>\u200b is dependent upon <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1<\/annotation><\/semantics><\/math>\u200b. <\/p>\n<p class=\"wp-block-paragraph\">So when <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1<\/annotation><\/semantics><\/math> modifications, it first modifications <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><msub><mi>x<\/mi><mi>i<\/mi><\/msub><mo>+<\/mo><msub><mi>b<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1x_i+b_1<\/annotation><\/semantics><\/math>, which in flip modifications the output of the ReLU. <\/p>\n<p class=\"wp-block-paragraph\">That is precisely the form of state of affairs the place we use the chain rule.<\/p>\n<p class=\"wp-block-paragraph\">So to search out how the ReLU modifications with respect to <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1<\/annotation><\/semantics><\/math>\u200b, we first discover how <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><msub><mi>x<\/mi><mi>i<\/mi><\/msub><mo>+<\/mo><msub><mi>b<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1x_i+b_1<\/annotation><\/semantics><\/math> modifications with respect to <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1<\/annotation><\/semantics><\/math>, after which how the ReLU modifications with respect to <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><msub><mi>x<\/mi><mi>i<\/mi><\/msub><mo>+<\/mo><msub><mi>b<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1x_i+b_1<\/annotation><\/semantics><\/math>\u200b. <\/p>\n<p class=\"wp-block-paragraph\">Lastly, we mix these two outcomes utilizing the chain rule.<\/p>\n<hr class=\"wp-block-separator has-text-color has-blue-gray-color has-alpha-channel-opacity has-blue-gray-background-color has-background is-style-dotted\"\/>\n<p class=\"wp-block-shortcode\">Now Substitute Again<\/p>\n<p>Earlier, we discovered<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\n-frac{2}{n}<br \/>\nsum_{i=1}^{n}<br \/>\n(y_i-hat{y}_i)<br \/>\nfrac{partialhat{y}_i}{partial w_1}<br \/>\n]<\/p>\n<p>We additionally calculated<\/p>\n<p>[<br \/>\nfrac{partialhat{y}_i}{partial w_1}<br \/>\n=<br \/>\nw_3<br \/>\nmathrm{ReLU}'(w_1x_i+b_1)<br \/>\nx_i<br \/>\n]<\/p>\n<p>Substitute this into the earlier equation.<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\n-frac{2}{n}<br \/>\nsum_{i=1}^{n}<br \/>\n(y_i-hat{y}_i)<br \/>\nw_3<br \/>\nmathrm{ReLU}'(w_1x_i+b_1)<br \/>\nx_i<br \/>\n]<\/p>\n<h3 class=\"wp-block-heading\">Remaining end result<\/h3>\n<p class=\"wp-block-shortcode\">Now we have derived<\/p>\n<p>[<br \/>\nfrac{partial L}{partial w_1}<br \/>\n=<br \/>\n-frac{2}{n}<br \/>\nsum_{i=1}^{n}<br \/>\n(y_i-hat{y}_i)<br \/>\nw_3<br \/>\nmathrm{ReLU}'(w_1x_i+b_1)<br \/>\nx_i<br \/>\n]<\/p>\n<p class=\"wp-block-paragraph\">This tells us precisely how the loss modifications when the load<\/p>\n<p class=\"wp-block-shortcode\">[w_1]<\/p>\n<p class=\"wp-block-paragraph\">modifications.<\/p>\n<p class=\"wp-block-paragraph\">At first, this equation might look obscure, however it&#8217;s really fairly easy.<\/p>\n<p class=\"wp-block-paragraph\">Because it tells us how the overall loss modifications after we make a really small change to the load w1\u200b, this worth known as the <strong>gradient<\/strong>, and it&#8217;s precisely what gradient descent makes use of to replace the load.<\/p>\n<p class=\"wp-block-paragraph\">To calculate this gradient, the equation considers each coaching instance within the dataset.<\/p>\n<p class=\"wp-block-shortcode\">For every coaching instance:<\/p>\n<p>[(y_i-hat{y}_i)] tells us how far the prediction is from the precise worth.<\/p>\n<p>[w_3] tells us how a lot the primary hidden neuron contributes to the ultimate prediction.<\/p>\n<p>[mathrm{ReLU}'(w_1x_i+b_1)] tells us whether or not the change in [w_1] can cross via the ReLU activation.<\/p>\n<p>[x_i] tells us how a lot a small change in [w_1] impacts the neuron\u2019s enter.<\/p>\n<p class=\"wp-block-paragraph\">Every coaching instance contributes its personal gradient primarily based on these portions. <\/p>\n<p class=\"wp-block-paragraph\">We add all of those particular person contributions collectively, and since we&#8217;re utilizing the Imply Squared Error (MSE) loss operate, dividing by <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>n<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">n<\/annotation><\/semantics><\/math> provides the typical gradient throughout the complete dataset.<\/p>\n<p class=\"wp-block-paragraph\">This common gradient tells us how <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>w<\/mi><mn>1<\/mn><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">w_1<\/annotation><\/semantics><\/math> needs to be adjusted to cut back the general loss, reasonably than simply the error for a single coaching instance.<\/p>\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n<p class=\"wp-block-paragraph\">If you happen to bear in mind our dialogue on Easy Linear Regression, we calculated the partial derivatives with respect to solely two parameters.<\/p>\n<p class=\"wp-block-paragraph\">On this weblog, we now have efficiently derived<\/p>\n<p class=\"wp-block-shortcode\">[frac{partial L}{partial w_1}]<\/p>\n<p class=\"wp-block-paragraph\">Though the derivation was lengthy, We used the identical concepts from calculus that we already knew in each step. <\/p>\n<p class=\"wp-block-paragraph\">We merely utilized differentiation step-by-step and used the chain rule wherever it was required.<\/p>\n<p class=\"wp-block-paragraph\">Now, our neural community nonetheless has <strong>six extra parameters<\/strong>, and every of them has its personal partial spinoff.<\/p>\n<p class=\"wp-block-paragraph\">So, what do you suppose?<\/p>\n<p class=\"wp-block-paragraph\">Do we have to repeat this whole course of for each weight and bias?<\/p>\n<p class=\"wp-block-paragraph\">Happily, no.<\/p>\n<p class=\"wp-block-paragraph\">As neural networks turn out to be bigger, manually deriving each gradient would shortly turn out to be arduous and inefficient.<\/p>\n<p class=\"wp-block-paragraph\"><strong>There needs to be a greater means.<\/strong><\/p>\n<p class=\"wp-block-paragraph\">The excellent news is that we don\u2019t want any new arithmetic. <\/p>\n<p class=\"wp-block-paragraph\">We merely want a greater method to manage these calculations. <\/p>\n<p class=\"wp-block-paragraph\">Every little thing continues to be constructed on the identical chain rule we\u2019ve been utilizing all through this text.<\/p>\n<p class=\"wp-block-paragraph\">Within the subsequent half, we\u2019ll see how the chain rule could be utilized effectively throughout the complete neural community, main us to probably the most necessary algorithms in deep studying: <strong>backpropagation<\/strong>.<\/p>\n<hr class=\"wp-block-separator has-text-color has-blue-gray-color has-alpha-channel-opacity has-blue-gray-background-color has-background is-style-dotted\"\/>\n<p class=\"wp-block-paragraph\">I hope you discovered one thing from this text. If you happen to\u2019re nonetheless confused about neural networks or wish to revisit the fundamentals, you&#8217;ll be able to all the time learn my earlier article<a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/neural-networks-explained-for-beginners-start-here-if-theyve-confused-you\/\"> right here<\/a>.<\/p>\n<p class=\"wp-block-paragraph\">If you happen to discovered this useful, be at liberty to share it with individuals who may have it.<\/p>\n<p class=\"wp-block-paragraph\">In case you will have any doubts or ideas, you&#8217;ll be able to touch upon <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.linkedin.com\/in\/nikhildasari-dataanalyst\/\">LinkedIn<\/a>.<\/p>\n<figure class=\"wp-block-pullquote\">\n<blockquote>\n<p><em>\u201cIt doesn&#8217;t matter how slowly you go so long as you don&#8217;t cease.\u201d<\/em><br \/><strong>\u2014 Confucius<\/strong><\/p>\n<\/blockquote>\n<\/figure>\n<p class=\"wp-block-paragraph\">Thanks for studying, and I\u2019ll see you in Half 2!<\/p>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>to know backpropagation? If you happen to\u2019re making an attempt to know how trendy AI techniques like giant language fashions (LLMs) are skilled, backpropagation is among the most necessary ideas to know. However should you ask me how I felt once I encountered it, I used to be utterly misplaced by wanting on the math [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":16884,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[5481,2785,475,1894,9845,668],"class_list":["post-16882","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-backpropagation","tag-beginners","tag-building","tag-explained","tag-intuition","tag-part"],"_links":{"self":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/16882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16882"}],"version-history":[{"count":1,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/16882\/revisions"}],"predecessor-version":[{"id":16883,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/16882\/revisions\/16883"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/media\/16884"}],"wp:attachment":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 69d9690a190636c2e0989534. Config Timestamp: 2026-04-10 21:18:02 UTC, Cached Timestamp: 2026-07-21 08:16:13 UTC -->