Last active
November 14, 2017 12:08
-
-
Save solaris33/ad569bf3480b849902344c3f96f77860 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
mu, sigma = 0, 0.1 # mean and standard deviation | |
# np.random.nomral 함수를 이용해서 평균 0, 표준편차 0.1인 sample들을 1000개 추출한다. | |
s = np.random.normal(mu, sigma, 1000) | |
# sample들의 historgram을 출력한다. | |
count, bins, ignored = plt.hist(s, 30, normed=True) | |
# sample들을 이용해서 Gaussian Distribution의 shape을 재구축해서 line으로 그린다. | |
plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) * | |
np.exp( - (bins - mu)**2 / (2 * sigma**2) ), linewidth=2, color='r') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment