In This Article, You Will Learn About Numpy Rayleigh Distribution.
Numpy Rayleigh Distribution – Before moving ahead, let’s know a bit of Python Chi-square Distribution
The Rayleigh distribution includes nonnegative-valued random.
It includes two parameters:
scale – Default value is 1.0. Standard Deviation decides how flat the distribution will be. size – Shape of the returned array.
Example – Creating an array of random numbers of size 3×3 for Rayleigh distribution.
from numpy import random
z = random.rayleigh(scale=2, size=(3, 3))
print(z)
Output - [[1.73291032 0.22618702 2.57752588] [4.65607906 4.45485698 4.16659537] [2.26514034 1.8622671 3.23452803]]
As shown above, it returned an array of shape 3×3 containing random numbers.
Note: Later you will learn more in our Python Rayleigh Distribution Tutorial.
View to Rayleigh Distribution and Chi Square Distribution
The distributions of rayleigh and square are the same at unit standard deviation.
Visualization of Rayleigh Distribution
Example – Visualizing the Rayleigh Distribution graph without histogram.
from numpy import random
import matplotlib.pyplot as plt
import seaborn as kl
kl.distplot(random.rayleigh(size=5000), hist=False)
plt.show()
As a result, it returned visualized the Rayleigh Distribution graph without histogram.
Example – Visualizing the Rayleigh Distribution graph with histogram.
from numpy import random
import matplotlib.pyplot as plt
import seaborn as kl
kl.distplot(random.rayleigh(size=5000))
plt.show()
As a result, it returned visualized the Rayleigh Distribution graph with histogram.
If you find anything incorrect in the above-discussed topic and have any further questions, please comment below.
Like us on