Visualise the Normal distribution
This post will help you to visualise the normal distribution for different variances
Physical meaning:
You can see that as variance reduces the curve becomes peakier as all the data is then squished within the narrow available range. As variance increases the curve becomes flatter.
Compute using Python:
# Import libraries
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Function that generates normal distribution
def gauss_gen(s):
x = np.random.normal(scale=s,size=(10000,1000)) #Variables of the required size will be drawn from a normal distrbution. By default, loc (mean) is 0, and scale(std deviation) is 1
return x
# Generate normal distributions with different variances
pdf0 = gauss_gen(1)
pdf1 = gauss_gen(1.41)
pdf2 = gauss_gen(0.71)
# Plot the Gaussian distributions
sns.distplot(pdf0,label='Variance 1')
sns.distplot(pdf1,label='Variance 2')
sns.distplot(pdf2,label='Variance 0.5')
plt.legend()
plt.show()
Comments
Post a Comment