Skip to Content
밑바닥부터 시작하는 딥러닝 5
book

밑바닥부터 시작하는 딥러닝 5

by 사이토 고키, 개앞맵시(이복연)
October 2024
Beginner to intermediate
340 pages
7h 38m
Korean
Hanbit Media, Inc.
Content preview from 밑바닥부터 시작하는 딥러닝 5
147
5
EM 알고리즘
종료 판정
다음 로그 가능도를 계산하여 이전 로그 가능도와 비교합니다.
5.5
EM
알고리즘 구현
이번 절에서는 올드 페이스풀 간헐천 데이터셋을 대상으로
EM
알고리즘을 구현합니다 (올드
페이스풀 간헐천에 대해서는
4
.
1
절에서 설명했습니다 ).
5.5.1
데이터셋과
GMM
코드
먼저 데이터셋을 불러오고
GMM
의 매개변수에 초깃값을 설정합니다.
import os
import numpy as np
path
=
os
.
path
.
join(os
.
path
.
dirname(
__
file
__
), 'old
_
faithful
.
txt')
xs
=
np
.
loadtxt(path)
print(xs
.
shape) # (272, 2)
#
매개변수
(
초깃값
)
phis
=
np
.
array([0
.
5, 0
.
5])
mus
=
np
.
array([[0
.
0, 50
.
0], [0
.
0, 100
.
0]])
covs
=
np
.
array([np
.
eye(2), np
.
eye(2)]) # np
.
eye()
단위행렬
생성
K
=
len(phis) #
가우스
분포
개수
(2
)
N
=
len(xs) #
데이터
(272
)
MAX
_
ITERS
=
100 # EM
알고리즘의
최대
반복
횟수
THRESHOLD
=
1e
-
4 # EM
알고리즘
갱신
중지
임곗값
step05/em.py
148
밑바닥부터 시작하는 딥러닝 5
xs
의 형상은 (
272 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

밑바닥부터 시작하는 딥러닝 4

밑바닥부터 시작하는 딥러닝 4

사이토 고키

Publisher Resources

ISBN: 9791169212960