Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

02%20mathematics/09.03%20%EB%B2%A0%EC%9D%B4%EC%A6%88%20%EC%B6%94%EC%A0%95%EB%B2%95 #83

Open
utterances-bot opened this issue Mar 18, 2024 · 1 comment

Comments

@utterances-bot
Copy link

9.3 베이즈 추정법 — 데이터 사이언스 스쿨

https://datascienceschool.net/02%20mathematics/09.03%20%EB%B2%A0%EC%9D%B4%EC%A6%88%20%EC%B6%94%EC%A0%95%EB%B2%95.html

Copy link

rom sklearn.datasets import load_iris
import numpy as np

iris = load_iris()
sepal_length = iris.data[:, 0] # 꽃받침의 길이

표본분산 계산

sample_variance = np.var(sepal_length, ddof=1)
#prior dist.
prior_mean = 1
prior_variance=1

베이즈추정법에 의한 기댓값 추정

post_variance = 1/(1/prior_variance+len(sepal_length)/sample_variance)
post_mean = post_variance*(prior_mean/prior_variance + np.sum(sepal_length)/sample_variance)

print('베이지안 추정에 의한 꽃받침 길이의 기댓값:', post_mean.round(2))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants