본문 바로가기
Python/통계

(1)정규분포 밀도함수 python 함수로 만들어보기

by 지식광부키우기 2019. 8. 20.
def normal_pdf(x, mu=0, sigma=1):
    sqrt_two_pi = math.sqrt(2 * math.pi)
    return (math.exp(-(x-mu) ** 2 / 2 / sigma ** 2) / (sqrt_two_pi * sigma))

 

※ 정규분포의 밀도함수 

 

$\mathit{f}(x | \mu,\sigma) = \frac{1}{\sqrt{2\pi \sigma }}exp(\frac{(x - \mu)^{2}}{2\sigma ^{2}})$  ($-\infty \leq x \leq \infty$)

 

 

이 글의 출처는 data science from scratch o'reilly입니다. 

'Python > 통계' 카테고리의 다른 글

정규분포 with python  (0) 2019.10.15
감마분포 with python  (0) 2019.10.14
(2)정규분포의 누적분포함수를 python으로 구현해보자  (0) 2019.08.22

댓글