Linear SVM KYA karta hai: yeh ek separating hyperplane w⊤x+b=0 dhundhta hai. Iska decision function, training ke baad, sirf dot products ke zariye likha ja sakta hai — query point x aur support vectors xi ke beech:
f(x)=∑iαiyi(xi⊤x)+b
Yeh KYUN matter karta hai: data xsirf dot productxi⊤x ke andar aata hai. Toh agar data apni raw form mein linearly separable nahi hai, toh hum ise ϕ(x) se ek richer space mein map kar sakte hain aur wahan separable hone ki umeed rakh sakte hain. Phir decision function ko ϕ(xi)⊤ϕ(x) chahiye hoga.
Trick humein KAISE bachati hai:ϕ(x) explicitly compute karna expensive ya infinite-dimensional ho sakta hai. Lekin agar ek function K ho jisme
K(x,z)=ϕ(x)⊤ϕ(z)
toh hum ϕ kabhi nahi banate. Bas har dot product ko K se replace kar dete hain. Yahi poora game hai.
Derivation.ϕ(x)=x lo. Phir ϕ(x)⊤ϕ(z)=x⊤z=K(x,z). Ho gaya. Yeh identity feature map ke saath ek kernel hai. Iska use tab karo jab d bada ho aur data already ~linearly separable ho (text, sparse features).
Yeh step KYUN? Har term ko (kuch x mein) × (wahi kuch z mein) ke roop mein group karo. Yahi grouping ek dot product ϕ(x)⊤ϕ(z) hai jisme
ϕ(x)=(x12,x22,2x1x2,2x1,2x2,1)
Toh degree-2 polynomial kernel chupke se aapko saare squares, cross-terms aur linear terms deta hai — 2 inputs se ek 6-dimensional feature space, sirf ek dot product aur ek square se compute kiya gaya. c control karta hai ki low-order terms ko kitna weight mile; bada c → lower-degree features par zyada emphasis.
Yeh step KYUN? Har (x⊤z)k khud degree k ka ek (homogeneous) polynomial kernel hai, yaani ek finite space mein dot product. Kernels ka weighted sum bhi ek kernel hota hai, aur yahan sum infinity tak jaata hai → RBF ek infinite-dimensional feature map se correspond karta hai jisme har degree ke polynomial features hain. Isliye yeh itna expressive hai.
2D mein degree-2 poly kernel (x⊤z+1)2 ka feature map?
(x12,x22,2x1x2,2x1,2x2,1).
RBF infinite-dimensional KYUN hai?
Kyunki e2γx⊤z=∑kk!(2γ)k(x⊤z)k har degree ke polynomial kernels ko mix karta hai.
RBF mein bade γ ka effect?
Bahut local influence → wiggly boundary → overfitting ka risk.
RBF mein chote γ ka effect?
Smooth, near-linear boundary → underfitting ka risk.
Linear kernel kab prefer karo?
High-dimensional sparse data (text) jahan nonlinearity overfit kare; speed ke liye bhi.
RBF/poly se pehle features scale KYUN karne chahiye?
Yeh ∥x−z∥2/x⊤z par depend karte hain, jo large-magnitude features se dominate hote hain.
Recall Feynman: ek 12-saal ke bachche ko samjhao
Socho tum do khilaunon ki "alikeness" judge kar rahe ho. Linear tarika: unhe line up karo aur dekho kitna same direction mein point karte hain. Polynomial tarika: unke combinations bhi compare karo — colour AUR size saath mein, sirf akela nahi. RBF tarika: bas measure karo kitne paas hain — touching khilaune "1" hain, door wale "0" hain. Jaadu ki baat yeh hai ki computer yeh alikeness seedha measure kar sakta hai, bina har possible combination ki giant table banaye. Yeh shortcut SVM ko groups ke beech curved fences draw karne deta hai, jabki sirf simple arithmetic karta hai.