Convenience sampling

Python में Sampling

James Chapman

Curriculum Manager, DataCamp

The Literary Digest की चुनाव भविष्यवाणी

1936 का Literary Digest का फ्रंट पेज, जिसमें चुनाव भविष्यवाणी की हेडलाइन है। Landon के 1.3 मिलियन वोट और Roosevelt के लगभग 1 मिलियन वोट दिखाए गए हैं.

  • भविष्यवाणी: Landon 57%; Roosevelt 43%
  • वास्तविक नतीजे: Landon 38%; Roosevelt 62%
  • सैंपल जनसंख्या का प्रतिनिधि नहीं था, इसलिए sample bias हुआ
  • सबसे आसान तरीके से डेटा इकट्ठा करना convenience sampling कहलाता है
Python में Sampling

फ़्रांसीसी लोगों की औसत आयु खोजना

Disneyland Paris की एक फोटो.

  • Disneyland Paris में 10 लोगों से सर्वे करें
  • औसत आयु 24.6 वर्ष
  • क्या यह पूरे फ्रांस के लिए अच्छा अनुमान होगा?
1 Image by Sean MacEntee
Python में Sampling

सर्वे कितना सटीक था?

Year Average French Age
1975 31.6
1985 33.6
1995 36.2
2005 38.9
2015 41.2
  • 24.6 वर्ष एक कमजोर अनुमान है
  • Disneyland जाने वाले लोग पूरी जनसंख्या का प्रतिनिधित्व नहीं करते
Python में Sampling

Convenience sampling में कॉफी रेटिंग्स

coffee_ratings["total_cup_points"].mean()
82.15120328849028
coffee_ratings_first10 = coffee_ratings.head(10)
coffee_ratings_first10["total_cup_points"].mean()
89.1
Python में Sampling

Selection bias का विज़ुअलाइज़ेशन

import matplotlib.pyplot as plt
import numpy as np
coffee_ratings["total_cup_points"].hist(bins=np.arange(59, 93, 2))
plt.show()

 

coffee_ratings_first10["total_cup_points"].hist(bins=np.arange(59, 93, 2))
plt.show()
Python में Sampling

जनसंख्या और convenience sample का वितरण

Population: जनसंख्या से कप पॉइंट्स का एक हिस्टोग्राम.

Convenience sample: सैंपल से कप पॉइंट्स का एक हिस्टोग्राम.

Python में Sampling

रैंडम सैंपल के लिए selection bias का विज़ुअलाइज़ेशन

coffee_sample = coffee_ratings.sample(n=10)
coffee_sample["total_cup_points"].hist(bins=np.arange(59, 93, 2))
plt.show()
Python में Sampling

जनसंख्या और simple random sample का वितरण

Population: जनसंख्या से कप पॉइंट्स का एक हिस्टोग्राम.

Random Sample: एक रैंडम सैंपल से कप पॉइंट्स का हिस्टोग्राम.

Python में Sampling

अभ्यास करते हैं!

Python में Sampling

Preparing Video For Download...