Skip to content

Commit bab9dd6

Browse files
committed
Dirichlet distribution
1 parent 9440532 commit bab9dd6

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

23.Beta_distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'''
2-
Beta distribution using matplotlib.pyplot, numpy.random module and seaborn librarys by hey sushil:
2+
Beta distribution using matplotlib.pyplot, numpy.random module and seaborn librarys by hey sushil (Chaudhary Sushil):
33
44
Probability theory ke andar aur statistics me isko continuous probability distribution familiy me rakha gaya hai.
55

24.Dirichlet_distribution.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
'''
2+
Dirichlet distribution using matplotlib.pyplot, numpy.random module and seaborn librarys by hey sushil (Chaudhary Sushil):
3+
4+
Probability and statistics me Dirichlet distribution, continuous multivariate probabiltiy distribution family ka member hai.
5+
6+
Multivariate Meaning: Multivariate Random variables ya random vector, mathematical values ka full list hota hai. Issme bhi wo values jo yata unkown hai ya unki value incomplete hai. Ayse data collection ko Multivarate kahte hain.
7+
8+
Dirichlet distribution ka use text mining me kiya jata hai.
9+
10+
Dirichlet distribution ko samjhne ke liye pahle inki jankari hona bahot jaruri hai:
11+
1. binomial distribution
12+
2. multinomial distribution
13+
3. gamma function
14+
4. beta distribution
15+
16+
aur inke relationships ko janan jaruri hai.
17+
18+
1 and 2 points ko jante ho.
19+
3. Gamma Function: Hum gamma distribution ki nahi balki function ki baat kar rahe hain. Because gamma distribution ka iss method se direct koi lena dena nahi hai.
20+
But Gamma function ko bahot acche se define kiya gaya hai kisi bhi complex number ko handel karne ke liye.
21+
Gamma function ke pass kuch spacial properties hain jinka use beta and Dirichlet distribution properties ko define karne me use kiya jata hai.
22+
23+
24+
Dirichlet distribution ke jaruri points:
25+
26+
1. Ye posative real number vector hai.
27+
2. Beta distribution ka multivariate generalization hai.
28+
3. Iska use Bayesian statistics me prior distribution ki tarah kiya jata hai.
29+
4. K-dimentional vector ka set, jiski entry positive real number ke [0,1] ke interval ke beach me kiya jata hai.
30+
31+
numpy.random.dirichlet arguments:
32+
alpha: Float sequence aur length k
33+
size: random numbers matrix
34+
35+
Reference Links:
36+
1. https://leimao.github.io/blog/Introduction-to-Dirichlet-Distribution/
37+
2. https://en.wikipedia.org/wiki/Dirichlet_distribution
38+
'''
39+
40+
import numpy.random as r
41+
import matplotlib.pyplot as plt
42+
43+
s = r.default_rng().dirichlet((10, 5, 3), 20).transpose()
44+
45+
# print('\ns: ', s);exit()
46+
47+
plt.barh(range(20), s[0])
48+
plt.barh(range(20), s[1], left=s[0], color='g')
49+
plt.barh(range(20), s[2], left=s[0]+s[1], color='r')
50+
plt.title('Length of String Using Dirichlet Distribution')
51+
52+
plt.show()

0 commit comments

Comments
 (0)