LA ILAHA ILLA HU
Allah, Your Lord There Is No Deity Except Him.
Python Data Science Machine Learning Lesson 5: Normal Data Distribution
In this type of data distribution, most of the values are concerntrated around a given value.This kind of data distribution is also known as Normal Data Distribution or Gaussian Data Distribution, named after the mathematician Carl Friedrich Gauss.
For doing this, you have to first import numpy as under
import numpy as np
Now, the python code for plotting Normal Data Distribution will be as under.
code
import numpy as np
import matplotlib.pyplot as plt
x = np.random.normal(10.0, 2.0, 1000000)
plt.hist(x, 100)
plt.show()
Note: As you can see, the shape of the above graph resembles a bell, because of this
characteristics, this graph is also known as bell curve.
Explanation of the above code:
The above array has been created from the numpy.random.normal() method, with 1000000 values, to draw a histogram with 100 bars.The value of mean is specified as 10.0.
The value of standard deviation is taken as 2.0.
Conclusion:
As you can observe from the histogram graph, most values are between 9.0 and 11.0,
with a top at approximately 10.0.
Note: if you have python installed on your pc you can install numpy as under.
Open Command Prompt from the start menu.
Inside the command prompt, type
pip install numpy
press enter
This command will install numpy on your computer after which you can run on python.
Note: if you have python installed on your pc you can install matplotlib as under.
Open Command Prompt from the start menu.
Inside the command prompt, type
pip install matplotlib
press enter
This command will install matplotlib on your computer after which you can run on python.