Skip to content

Commit 3f55e22

Browse files
committed
Zipf Distribution
1 parent 64a3bf0 commit 3f55e22

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

22.Zipf_Distribution.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
'''
2+
Zipf Distribution using matplotlib.pyplot, numpy.random module and seaborn librarys by hey sushil:
3+
4+
Zipf Distribution ka use karke sample data find kiya jata hai. Ye discrete distribution hai. Discrete distribution ki family me kafi populer distributions hai jaise ki Binomial, Multinomial, Poisson etc.
5+
Discrete distribution wo hai jisme ek lambi random number ki list hoti hai. Jise ki non-negative integer values.
6+
7+
Zipf Distribution ke baareme important points:
8+
9+
1. Isko waise Zita Distribution bhi kahte hain.
10+
2. Issi ko Discreate Pareto Distribution bhi kahte hain
11+
3. Is discrete distribution ka use:
12+
a. Linguistics
13+
b. Insurance
14+
c. Modeling of rare events
15+
16+
Zipf Distribution ka Example:
17+
18+
1. Kisi bhi collection me nth common term 1/n time ayga wo bhi us collection ke sabse common termse mese.
19+
2. English me 5th common word 1/5th time kisi bhi santance me sunne ko mil jayega.
20+
3. English me 'The' word ka use sabse jada hota hai. Uske bad sabse jada use kiye jane wala word hai 'of' aur bhi so on. Isska matlab hai hi ye kram ayse hi chalta hai.
21+
4. Agar isko last tak le kar jaya jaye to graph me base star ke result me hame plane line show hoga. Means bahot bade result me sab equal ho jayega.
22+
23+
numpy.random.zipf() method ke arguments:
24+
25+
1. a: distribution parameter
26+
2. size: return array shap
27+
28+
Zipf Distribution se related aur kuch baate:
29+
30+
1. Zipf's law ko probability me kuch ayse dekha jata hai ki, yaha par kise event ki hone ki frequency (f) hoti hai aur uska rank (r) hota hai.
31+
2. Iss law ko American linguist George Kingsly Zipf (1902-1950) ne diya tha.
32+
3. Iss law ko unhone ne English me kisi bhi word ke aane ki frequecy ko janne ke liye iss law ko diya tha. Joki aaj bahot hi popular aur Machine Learning me bahot jada useful hai.
33+
4. Wise hi Zipf ne 1949 me issi law me ye bhi claim kiya tha ki, desh me maujud sab se bada sahar, dusre sahar se doguna bada hai aur 3rd wala se tiguna bada hai and so on. Lekin ye law kewal wahin par fit batha iska use language me ya kcuh aur case me sahi fit nahi bathta hai.
34+
35+
Jada jankari ke liye:
36+
1. https://www.sciencedirect.com/topics/computer-science/zipf-distribution
37+
2. https://www.nngroup.com/articles/zipf-curves-and-website-popularity/
38+
3. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4176592/
39+
4. https://plus.maths.org/content/mystery-zipf
40+
'''
41+
42+
import numpy.random as r
43+
import matplotlib.pyplot as plt
44+
import seaborn as sns
45+
46+
zipf = r.zipf(a=2, size=(1000))
47+
# print('\n',zipf)
48+
# print('\n',zipf[zipf<10]);exit()
49+
sns.distplot(zipf[zipf<20], kde=False)
50+
51+
plt.xlabel('Rank X')
52+
plt.ylabel('Frequencey Y')
53+
plt.title('Zipf Distribution')
54+
plt.xlim(0,100)
55+
plt.ylim(0,100)
56+
57+
plt.show()

0 commit comments

Comments
 (0)