5.6.1 · D1 · HinglishMachine Learning (Aerospace Applications)

FoundationsLinear regression — normal equation, gradient descent derivation

2,012 words9 min read↑ Read in English

5.6.1 · D1 · Coding › Machine Learning (Aerospace Applications) › Linear regression — normal equation, gradient descent deriva

Tumhe parent note Linear Regression fluently padhne se pehle, us mein aane wala har ek symbol apna banana hoga. Yeh page har ek symbol ko scratch se build karta hai, ek aisi order mein jahan har block usse pehle waale par tikaa ho. Upar se neeche padho.


1. Ek data point

Socho dots ki ek scatter. Har dot ek horizontal position aur ek height par baithi hai.

Figure — Linear regression — normal equation, gradient descent derivation
  • → dot kitni right mein hai (woh cheez jo tum jaante ho, jaise altitude).
  • → dot kitni upar hai (woh cheez jo tum predict karna chahte ho, jaise fuel burn).
  • → dots ki count. Agar runs karta hai toh .

Yeh topic isko kyun chahta hai. Regression ka poora kaam in sab dots ko ek rule se summarise karna hai. "Dot number " ke liye koi symbol ke bina hum "ek saath saare dots" ke baare mein baat nahi kar sakte.

Is line ko padho
paanchwe data point ka input hai; subscript ek label hai, exponent nahi.

2. Prediction aur line

Ek seedhi line ke do knobs hote hain:

Figure — Linear regression — normal equation, gradient descent derivation

Do knobs kyun, ek kyun nahi? Sirf se line origin se guzarne par majboor hoti; real data rarely zero se guzarta hai, isliye line ko upar ya neeche freely slide karne deta hai.


3. Error aur hum usse square kyun karte hain

Figure — Linear regression — normal equation, gradient descent derivation

Figure mein vertical dashed sticks dekho — har ek ek error hai. Hum chahte hain ki saari sticks ki total length chhoti ho. Lekin ek trap hai:

Toh hum jo quantity minimise karte hain woh squared errors ka sum hai:

Symbol (capital Greek sigma) ka matlab hai "dayi taraf ki cheez ko ke liye jod do." Yeh ek compact "sab jod do" hai.

equals
.

4. Cost function

kyun?

  • isko ek mean (average) banata hai, taaki score sirf isliye blow up na ho kyunki tumhare paas zyada data hai.
  • Extra ek convenience hai: jab hum differentiate karte hain, square upar se ka factor laata hai, aur usse cancel kar deta hai toh formulas clean rehte hain. Yeh kabhi nahi badalta kahan minimum hai.

5. Vectors aur matrices — bulk notation

Jab bahut saare inputs aur bahut saare points hote hain, toh sums haath se likhna unbearable ho jaata hai. Hum numbers ko grids mein pack karte hain.

  • → point ke saare inputs ek column mein stack kiye hue.
  • design matrix: rows (ek per point), columns (ek per input feature). Symbol sirf kehta hai "real numbers ki ek grid jisme rows aur columns hain."
  • → true answers ka column.
  • → weights ka column, har feature ke liye ek.

Transpose

Matrix-times-vector

Yeh saari predictions ek object mein pack karta hai. ki row exactly hai. Toh = guesses ka poora column ek symbol mein.

Dot product aur

Norm

in words
ek saath har point ka total squared error.

Yeh Least Squares Estimation ki language hai aur Matrix Pseudoinverse par tikaa hai.


6. Slope, derivative, gradient — downhill compass

Figure — Linear regression — normal equation, gradient descent derivation

Gradient descent mein minus sign kyun? Gradient uphill (zyada cost ki taraf) point karta hai. Hum kam cost chahte hain, isliye hum opposite direction mein step lete hain: . Yahi hai ka poora logic.

  • = learning rate: kitna bada step lena hai. Zyada bada → valley overshoot karo aur bounce karo; bahut chhota → rengna. Feature Scaling dekho ki kyun unequal input sizes ko tiny rehne par majboor karti hain.
  • Subscript = iteration number (), ek time step, koi power nahi.
  • (epsilon) = ek tiny threshold; "jab change se chhota ho tab ruk jao."
Minimum par gradient equals
zero (valley floor flat hota hai).

7. Yeh sab kaise fit hote hain

Bowl-shaped ka exactly ek hi bottom hai kyunki yeh convex hai — dekho Convex Optimization. Yahi guarantee hai ki dono methods ek hi best line tak pahunchte hain.

Data points x_i y_i

Line model y-hat = w x + b

Error y minus y-hat

Square and average = cost J

Vectors and matrices X w y

Norm = length squared

Convex bowl one minimum

Derivative = slope

Gradient = downhill arrow

Normal equation one leap

Gradient descent many steps

Aage yahi machinery Regularization (Ridge, Lasso), Kalman Filtering, aur Neural Networks mein badhti hai.


Equipment checklist

Dayi taraf cover karo aur oonchi awaaz mein jawab do. Agar koi ruk jaaye, toh woh section dobara padho.

mein hat ka kya matlab hai?
Yeh line ki guessed value hai, measured truth nahi.
Do knobs aur kya hain aur har ek kya karta hai?
slope (steepness), bias (vertical shift).
Hum errors ko raw add karne ki jagah square kyun karte hain?
Taaki positive aur negative misses cancel na ho sakein, aur taaki cost calculus ke liye smooth rahe.
tumhe kya karne ko kehta hai?
Aane wale expression ko se tak har point ke liye jod do.
kya single number report karta hai?
Average squared error — current line kitni buri hai.
plain words mein kya hai?
Ek saath har data point ke liye predictions ka poora column.
kya compute karta hai?
Entries ke squares ka sum — squared length.
Gradient kya hai aur woh kahan point karta hai?
Saari partial slopes ka vector; yeh cost ki steepest increase ki taraf point karta hai.
Update mein minus sign kyun hai?
Hum cost kam karne ke liye uphill gradient ke opposite step lete hain.
"Bias trick" kya hai?
mein ones ka ek column add karna taaki pehla weight automatically ban jaaye.