5.6.8 · D4 · HinglishMachine Learning (Aerospace Applications)

ExercisesBackpropagation — chain rule, gradient computation

2,669 words12 min read↑ Read in English

5.6.8 · D4 · Coding › Machine Learning (Aerospace Applications) › Backpropagation — chain rule, gradient computation

Poore page mein, ek chota scalar network reuse kiya gaya hai taaki numbers checkable rahein:

Yahan input number hai, target hai (woh "sahi jawab" jo hum chahte the), (padho "y-hat") network ki guess hai, aur loss hai — ek single number jo measure karta hai ki guess kitni galat hai. Letters (weights) aur (biases) tunable knobs hain. Symbol (padho "sigma") activation function hai, ek bend jo ek number par apply hoti hai; uski slope hai par. Greek (padho "delta") ek node par error signal hai: , yaani "loss kitna change hota hai agar is node ki pre-activation value thodi si nudge kare."

Figure — Backpropagation — chain rule, gradient computation

Upar figure dekho: orange arrows left-to-right jaate hain (forward pass, guess compute karta hai), magenta arrows right-to-left jaate hain (backward pass, carry karta hai). Neeche har exercise un arrows ke saath ek journey hai.


Level 1 — Recognition

Recall Solution L1.1

Chain rule. Nested (composed) functions ke liye, sensitivities multiply hoti hain: agar thoda sa wiggle kare, toh wiggle karta hai times us amount se, phir wiggle karta hai times us se, aur aise aage. In scalings ko chain karne se milta hai Sum tab aata hai jab , tak alag-alag kai paths se pahunchta hai (multivariable chain rule); ek seedha chain ek hi path hai, isliye yeh pure product hai. Dekho Chain Rule.

Recall Solution L1.2

ko ke respect mein differentiate karo: aur power-2 cancel ho jaate hain, bacha Yeh seed isliye hai kyunki yeh backward pass ka sabse pehla number hai — "hum kitne galat hain, aur kis direction mein" wali quantity, jisse baad ke saare gradients ugaaye jaate hain.

Recall Solution L1.3

Forward step inputs ko matrix se multiply karta hai (ek linear map). Input ke respect mein linear map ki derivative transpose hai (rows aur columns swap ho jaate hain), inverse nahi. Backprop differentiation hai, aur ek linear map ko differentiate karna use transpose karta hai; yahan kuch bhi undo/invert nahi ho raha.


Level 2 — Application

Use karo with . ReLU (Rectified Linear Unit) hai : positives ko unchanged pass karta hai aur negatives ko par clamp karta hai. Iska slope hai for aur for . Dekho Activation Functions.

Recall Solution L2.1

Figure 1 ke orange arrows walk karo:

Recall Solution L2.2

Seed phir chain. Kyunki hai, , isliye Kyunki hai: aur . Isliye Isko aise padho — error out × signal in: ka gradient uska downstream error () times uska apna input () hai.

Recall Solution L2.3

Error se back flow karta hai aur local slope se scale hota hai. Kyunki hai, : Phir aur ke saath:


Level 3 — Analysis

Recall Solution L3.1

Forward: , toh , , , . Backward: . Seed bhi zero hai. Aur slope hai kyunki hai. Toh Saare layer-1 gradients vanish ho jaate hain. ReLU apne flat region mein hai — unit "dead" hai. Koi error zero slope se pass nahi kar sakta, toh ke liye learning ruk jaati hai. Yeh Vanishing Gradients ka ek baby case hai.

Recall Solution L3.2

Chain rule ko local derivatives ke product mein factor karta hai. Har ek baar compute hota hai aur us node ko feed karne wale har weight ke liye reuse hota hai: se build hota hai (jo pehle se known hai), aur har weight ka gradient hai. Toh ek backward sweep cached quantities reuse karta hai aur har edge ko ek baar touch karta hai — total kaam edges ki sankhya ke proportional hai, yaani ek forward pass jitna. Naive finite-difference method instead poore net ko per weight re-run karta hai: passes. Yahi reuse hai jo Automatic Differentiation mechanise karta hai. Dekho Computational Graphs.

Recall Solution L3.3

Value , ko do independent paths se influence karta hai. Multivariable chain rule kehta hai total sensitivity per-path sensitivities ka sum hai — har path ka contribution (us path par weight) × (us path ke target par error) hai. Figure 2 dekho: do magenta arrows par milte hain aur unke blames add hote hain.

Figure — Backpropagation — chain rule, gradient computation

Level 4 — Synthesis

Recall Solution L4.1

Forward: . ReLU clamp karta hai: . Phir , , . Backward: ; slope (kyunki ); . Weight gradient outer product "error × input" hai: , aur . Har gradient zero hai — phir ek dead unit. Yeh dikhata hai ki vector rule scalar logic ko elementwise reproduce karta hai.

Recall Solution L4.2

Forward: , toh ; , , . Backward: . , . (positive), toh . Vector weight gradient (outer product): Notice karo ki har component (corresponding input) hai — bade input () ko touch karne wala weight bada gradient pata hai.

Recall Solution L4.3

Update rule : Sanity check: abhi bhi hai, new , new . Kyunki hai, loss decrease hua — gradient descent downhill step liya, jaise intended tha.


Level 5 — Mastery

Recall Solution L5.1

Forward: , . Phir , , . Backward: . Local slope . Saturation: jab , ya , toh . Kyunki mein ka factor hai, gradient ki taraf throttle ho jaata hai — classic sigmoid Vanishing Gradients problem. Peak slope sirf hai, toh best case mein bhi sigmoids error ko per layer shrink karte hain.

Recall Solution L5.2

Sigmoid net ke saath, (kyunki ). , . Numerically slope estimate , jo L5.1 ke se paanch decimals tak match karta hai. ✓ Central vs forward: central formula ka error ki tarah shrink karta hai (odd, first-order error terms symmetry se cancel ho jaate hain), jabki one-sided forward difference ki tarah err karta hai. Toh central estimate same ke liye bahut zyada accurate hai.

Recall Solution L5.3

  • : geometrically — vanishing gradients; deep front layers barely learn karte hain.
  • : — error intact pass hota hai, healthy regime jo skip-connections aur careful initialisation engineer karne ki koshish karte hain.
  • : exploding gradients; updates blow up ho jaate hain jab tak clip na karein. Yeh single product hi woh reason hai kyun depth delicate hai, aur kyun aerodynamic data ke surrogate nets (Neural Network Surrogate Models (CFD)) ko band mein rehne ke liye normalisation aur residual paths ki zaroorat hoti hai.

Active recall

Zero-output-or-slope?
Zero slope ; yeh error signal ko block karta hai output value se regardless.
Weight gradient ke liye outer product kyun?
Gradient ko weight ki shape match karni chahiye; entry hoti hai , jo outer product deta hai.
Depth ke across vanish/survive/explode kya govern karta hai?
Per-layer factors ka product jahan : vanish, survive, explode.

Connections

  • Backpropagation — chain rule, gradient computation (index 5.6.8) — woh parent jise yeh exercises drill karte hain.
  • Chain Rule · Gradient Descent · Computational Graphs · Automatic Differentiation — upar use ki gayi machinery.
  • Activation Functions · Vanishing Gradients — L3/L5 saturation aur depth analysis.
  • Neural Network Surrogate Models (CFD) — jahan yeh stability lessons aerospace ML mein kaam aate hain.