Normal distribution

Normal distribution, or Gaussian distribution, is a function that distributes the list of random variables in a graph that is shaped like a symmetrical bell. I am pretty sure that you will have encountered this term numerous times in your data science career. But have you understood its concept? Well, a normal distribution has a density curve that is symmetrical about its mean, with its spread typically defined by its standard deviation. It has two parameters – the mean and the standard deviation. The fact that the normal distribution is principally based on the central limit theorem makes it relevant. If the size of all possible samples in a population is n, and the mean is μ and the variance σ2 , then the distribution approaches a normal distribution. Mathematically, it is given as follows:

Now, let's see how we can draw an illustration for normal distribution using the Python stats library: 

from scipy.stats import norm

normal_data = norm.rvs(size=90000,loc=20,scale=30)
axis = sns.distplot(normal_data, bins=100, kde=True, color='skyblue', hist_kws={"linewidth": 15,'alpha':0.568})
axis.set(xlabel='Normal Distribution', ylabel='Frequency')

The output of the preceding code is as follows:

We can get a normal distribution graph using the scipy.stats modules by the norm.rvs() method. It allows the loc argument to set the mean of the distribution, the scale argument to set the standard deviation, and finally the size argument to indicate the number of random variables. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.178.151