Theory
क्या एक चीज़ दूसरी Predict करती है?
Placement data के बारे में एक natural question: क्या higher attendance higher marks के साथ जाती है? और क्या आप marks predict करने के लिए attendance इस्तेमाल कर सकते हैं? ये variables के बीच relationship के बारे में questions हैं, और इनका answer देना regression और इसके supporting measures का काम है।
यह lesson regression introduce करता है (एक variable दूसरों पर कैसे depend करता है यह model करना), dependent और independent variables की vocabulary, और variables साथ कैसे move करते हैं यह measure करने के दो tools: covariance (direction) और correlation (एक fixed scale पर strength)।
Theory
Regression, Dependent, और Independent
Regression एक numeric outcome predict करने के लिए variables के बीच relationship model करता है। सबसे simple case में, आप एक line fit करते हैं जो सबसे अच्छी तरह describe करती है एक variable दूसरे के साथ कैसे change होता है।
जिस variable को आप predict करना चाहते हैं वह dependent variable है (अक्सर Y कहा जाता है, response या target), यह बाकियों पर depend करता है। जिन variables को आप inputs की तरह इस्तेमाल करते हैं वे independent variables हैं (X, predictors या features)। उदाहरण के लिए, एक student के marks (dependent) को इनकी attendance (independent) से predict करने के लिए, marks Y है, attendance X है। कौन सा कौन है यह नाम देना किसी भी regression का first step है।
Theory
Covariance और Correlation
दो variables साथ move करते हैं या नहीं measure करने के लिए, आपके पास दो tools हैं।
Covariance आपको direction बताता है: एक positive covariance का मतलब है ये together rise करते हैं (ज़्यादा attendance, ज़्यादा marks); एक negative का मतलब है एक rise होने पर दूसरा fall होता है। पर इसका size variables की units पर depend करता है, तो raw number interpret करना hard है।
Correlation इसे minus 1 से plus 1 तक एक fixed scale पर standardise करके fix करता है: +1 एक perfect positive relationship है, -1 एक perfect negative, और 0 का मतलब कोई linear relationship नहीं है। Magnitude units से independent strength दिखाता है, तो 0.99 का एक correlation बहुत strong है, जबकि 0.1 weak है। Correlation covariance है जो comparable बनाया गया है।
Practical
pandas में Correlation (verified)
import pandas as pd
df = pd.DataFrame({
"marks": [80, 55, 90, 70, 60],
"projects": [3, 1, 4, 2, 1],
})
print(df["marks"].corr(df["projects"])) # 0.991 -> strong positive
print(df["marks"].cov(df["projects"])) # positive number -> same direction
# Correlation is on a fixed scale: -1 ... 0 ... +1
# 0.991 is very close to +1, so marks and projects rise strongly together (here).This example runs in Gri-Learn on the web, where you can edit it and see the output.
Quiz
दो variables का correlation +0.99 है। यह आपको क्या बताता है?
- ये लगभग unrelated हैं, क्योंकि 0.99 small है
- इनका एक बहुत strong positive linear relationship है: एक rise होने पर, दूसरा भी rise होता है
- एक definitely दूसरे को cause करता है
- Correlation invalid है, क्योंकि correlation 1 से ऊपर होना चाहिए
Show the answer
इनका एक बहुत strong positive linear relationship है: एक rise होने पर, दूसरा भी rise होता है
Correlation -1 से +1 तक चलता है, तो +0.99 maximum के बहुत near है, एक बहुत strong POSITIVE linear relationship indicate करते हुए: एक variable rise होने पर, दूसरा भी rise होता है। Option A backwards है: 0.99, +1 के near है, जो बहुत strong है, small नहीं (weak 0 के near होता)। Option C classic trap है, correlation causation IMPLY नहीं करता; एक strong correlation दिखाता है variables together move करते हैं, पर यह prove नहीं करता एक दूसरे को cause करता है (एक hidden third factor दोनों को drive कर सकता है)। Option D wrong है: correlation -1 से +1 के भीतर bounded है, तो 0.99 perfectly valid है, 1 से ऊपर values impossible हैं। Correlation को sign (direction) और magnitude (strength) से पढ़िए, और correlation से cause तक कभी leap मत कीजिए।
Think first
Correlation Causation क्यों Prove नहीं करता?
अगर दो variables strongly correlated हैं, आप conclude क्यों नहीं कर सकते कि एक दूसरे को cause करता है? फिर tap कीजिए।
Show the answer
क्योंकि correlation सिर्फ़ यह दिखाता है दो variables साथ MOVE करते हैं, WHY नहीं, और एक के दूसरे को cause करने के अलावा इसकी कई innocent वजहें हैं। सबसे common एक hidden THIRD variable (एक confounder) है जो दोनों को drive करता है। मान लीजिए ice-cream sales और swimming-pool drownings साल के across strongly correlated हैं; ice cream drowning cause नहीं करता, बल्कि एक third factor, hot weather, दोनों को independently बढ़ाता है। Placement data में, ज़्यादा projects वाले students के marks भी higher हो सकते हैं, पर हो सकता है एक third trait (motivation, या ability) दोनों को बढ़ाए, projects को directly marks cause करने की बजाय। DIRECTION का problem भी है: भले दो चीज़ें causally linked हों, अकेले correlation आपको नहीं बता सकता किस तरफ (क्या study करना marks बढ़ाता है, या high-marks students ज़्यादा study करना choose करते हैं?), और कभी-कभी एक correlation pure COINCIDENCE है, especially small samples में। Actually causation establish करने के लिए आपको correlation से ज़्यादा चाहिए: controlled experiments, या careful methods जो confounders और reverse causation rule out करते हैं। यही वजह है 'correlation causation imply नहीं करता' data analysis में सबसे important cautions में से एक है: एक strong correlation investigate करने लायक एक clue है, cause का proof नहीं। साथ move करना एक को दूसरे को happen कराने के same नहीं है।
Summary
Key takeaways
- Regression एक numeric outcome predict करने के लिए variables के बीच relationship model करता है (अक्सर एक line fit करके)।
- Dependent variable (Y) वह है जो आप predict करते हैं; independent variable(s) (X) वे inputs हैं जो इसे predict करने के लिए इस्तेमाल होते हैं।
- Example: attendance (independent) से marks (dependent) predict कीजिए।
- Covariance दिखाता है दो variables किस direction में move करते हैं: positive (together rise) या negative (एक rise, दूसरा fall); इसका size unit-dependent है।
- Correlation इसे -1 से +1 तक एक fixed scale पर standardise करता है: sign direction है, magnitude strength है (0 = कोई नहीं)।
- Correlation causation IMPLY नहीं करता: variables एक hidden third factor, reverse direction, या coincidence की वजह से together move कर सकते हैं।
- Memory hook: independent X से dependent Y; direction के लिए covariance, strength के लिए correlation (-1 से +1)।