Recall Aise Samjho Jaise Main 12 Saal Ka Hoon: Log Scales Kyun?
Socho tum measure kar rahe ho cheezein kitni tezi se badhti hain. Ek bacteria colony har ghante double hoti hai: 1 → 2 → 4 → 8 → 16 → 32. Agar tum ise regular paper par plot karo, toh line upar ki taraf bahut steep curve karti hai aur tumhe starting numbers dikhai nahi dete.
Lekin yahan trick hai: har doubling same type ka change hai (×2). Toh chalao ek special ruler banate hain jahan equal distances ka matlab hai "same amount se multiply karo." Ab tumhare ruler par 1→2 aur 16→32 same distance par hain. Yahi log scale hai!
Jab tum log use karte ho, $100 \to \infty1000 (×10) bilkul same dikhta hai jaise \1000 \text{ to }10,000 (×10). Isliye hum income data ko log-transform karte hain — tumhara dimaag "kitne guna bada" ki terms mein sochta hai, na ki "kitne dollars zyada." Yeh fark hai "meri salary double ho gayi!" aur "mujhe \50k raise mila" ke beech mein (jo totally alag cheezein hain agar tumne $25k se shuru kiya tha versus $200k se).
2.2.03-Polynomial-Features — Non-linearity capture karne ka log ka alternative
4.1.02-Decision-Trees — Trees ko transformations kyun nahi chahiye (split-based hote hain)
#flashcards/ai-ml
Log transformation kaunsi problem solve karta hai? :: Right skewness reduce karta hai, large values compress karta hai, multiplicative relationships ko additive mein convert karta hai (jaise income, population), heteroscedastic data ke liye variance stabilize karta hai.
Box-Cox formula λ≠ 0 ke liye
(x^λ - 1) / λ. -1 aur λ se division ise λ=0 par continuous banata hai (jahan L'Hôpital's rule se yeh log(x) ban jaata hai).
Yeo-Johnson kab use karna zaroori hai Box-Cox ki jagah?
Jab data mein zero ya negative values hoon. Box-Cox ke liye x > 0 zaroori hai; Yeo-Johnson x≥ 0 aur x < 0 ke liye alag formulas ke saath saare real numbers handle karta hai.
x=0 ko handle karne ke liye (kyunki log(0) undefined hai). Numpy mein log1p kehte hain. Alternative: domain-appropriate constant add karo (jaise counts ke liye 1).
Log-transformed target par training ke baad original units mein predictions kaise laate hain?
Inverse apply karo: exp(ŷ_log). Agar E[y] chahiye (median nahi) toh Jensen's inequality ki wajah se bias correction exp(ŷ + σ²/2) add karo.
Box-Cox λ train/test split se pehle fit karna chahiye ya baad mein?
Baad mein. λ sirf training data par fit karo, phir same λ test data par apply karo (kisi bhi aur preprocessing parameter ki tarah). Split se pehle saare data par fit karna information leak karta hai.
Kaun se models log/power transformations se benefit nahi lete?
Tree-based models (Random Forest, XGBoost, decision trees) kyunki yeh monotonic transformations ke liye invariant hote hain — yeh distances par nahi, thresholds par split karte hain.
Box-Cox λ=0.5 kya represent karta hai?
Square root transformation. λ=1 identity hai (koi transform nahi), λ=0 log hai, λ=-1 reciprocal hai (-1/x).