Skip to content

Commit 4ff5fbd

Browse files
committed
Beta distribution
1 parent 3cd9f96 commit 4ff5fbd

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

23.Beta_distribution.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
'''
2+
Beta distribution using matplotlib.pyplot, numpy.random module and seaborn librarys by hey sushil:
3+
4+
Probability theory ke andar aur statistics me isko continuous probability distribution familiy me rakha gaya hai.
5+
6+
Beta distribution ko [0, 1] interval ke beach me define kiya jata hai.
7+
8+
Beta distribution ko 2 possitive paramerters se denote kiya jata hai:
9+
1. alpha
10+
2. beta
11+
12+
Beta distribution ke andar ye dono parameters ye kaam karte hain:
13+
1. Random varibale ke exponent ke roop me hota hai.
14+
2. Durshra, ye distribution ke shape ko control karta hai.
15+
3. Agar isko multiple varaible me generalize kiya jaye to uss case me ye- Dirichlet distributon ban jata hai.
16+
17+
Beta distribution ka use random variable ya matrix model ke andar ek limited length me hi kai shape me change kiya ja sake uske liye kiya jata hai.
18+
19+
Beta distribution ka best use random variables ke sath percantages and proportions nikalne me kiya jata hai.
20+
21+
Kuch important points:
22+
23+
1. Beta distribution, ek special case hai Dirichlet distribution ka.
24+
2. Beta distribution, Gamma distribution se related hai.
25+
3. Beta distribution, ka use Bayesian interface aur order statistics me bhi kiya jata hai.
26+
27+
Note: Beta function bhi hota hai but wo math me hota hai. Iss ko Eular integral of fist kind bhi kahte hain.
28+
Ye special type ka function hai jo gamma function aur Binomial coefficent ke pass hota hai.
29+
30+
numpy.random.beta method arguments:
31+
a: Float or array like float values and non-negative (for Alpha)
32+
b: Float or array like float values and non-negative (for Beta)
33+
size: int or tuple of int values in return
34+
'''
35+
36+
import numpy.random as r
37+
import seaborn as sns
38+
import matplotlib.pyplot as plt
39+
40+
# print('\n', r.beta(a=0.5, b=0.5, size=(10)))
41+
42+
# a and b both on same range
43+
sns.distplot(r.beta(a=0.5, b=0.5, size=(100,100)), hist=False, label='a=0.5 b=0.5')
44+
45+
# a point high and b point low to show hight to low ratio
46+
sns.distplot(r.beta(a=5, b=1, size=(100,100)), hist=False, label='a=5 b=1')
47+
48+
sns.distplot(r.beta(a=1, b=5, size=(100,100)), hist=False, label='a=1 b=5')
49+
50+
sns.distplot(r.beta(a=2, b=2, size=(100,100)), hist=False, label='a=2 b=2')
51+
52+
sns.distplot(r.beta(a=2, b=5, size=(100,100)), hist=False, label='a=2 b=5')
53+
54+
# plt mehtods to beutify the result
55+
# plt.xlim(0,1)
56+
# plt.ylim(0,2.5)
57+
plt.xlabel('Range of X')
58+
plt.ylabel('Frequcry of Y')
59+
plt.title('Beta Distribution')
60+
61+
plt.show()

0 commit comments

Comments
 (0)