파일:Em old faithful.gif
testwiki
둘러보기로 이동
검색으로 이동
Em_old_faithful.gif (360 × 360 픽셀, 파일 크기: 272 KB, MIME 종류: image/gif, 반복됨, 30 프레임, 6.0 s)
이 파일은 위키미디어 공용에 있으며, 다른 프로젝트에서 사용하고 있을 가능성이 있습니다. 해당 파일에 대한 설명이 아래에 나와 있습니다.
파일 설명
| 설명Em old faithful.gif | An animation of the EM algorithm to a 2 component Gaussian mixture model on the Old Faithful dataset |
| 날짜 | |
| 출처 | 자작 |
| 저자 | 3mta3 (talk) 16:55, 23 March 2009 (UTC) |
Created in R with code below (released under same license as image), combined into animated gif using ImageMagick.
There should be a way to make this file smaller (e.g. using less colours or an animated PNG). If you can, feel free to upload a new copy.
#load library for multivariate normal
library(mvtnorm)
#load Old Faithful data frame
data(faithful)
#setup grid for plotting
xpts <- seq(from=1,to=6,length.out=100)
ypts <- seq(from=40,to=100,length.out=100)
#initial parameter estimates (chosen to be deliberately bad)
theta <- list(
tau=c(0.5,0.5),
mu1=c(2.8,75),
mu2=c(3.6,58),
sigma1=matrix(c(0.8,7,7,70),ncol=2),
sigma2=matrix(c(0.8,7,7,70),ncol=2)
)
#E step: calculates conditional probabilities for latent variables
E.step <- function(theta)
t(apply(cbind(
theta$tau[1] * dmvnorm(faithful,mean=theta$mu1,sigma=theta$sigma1),
theta$tau[2] * dmvnorm(faithful,mean=theta$mu2,sigma=theta$sigma2)
),1,function(x) x/sum(x)))
#M step: calculates the parameter estimates which maximise Q
M.step <- function(T) list(
tau= apply(T,2,mean),
mu1= apply(faithful,2,weighted.mean,T[,1]),
mu2= apply(faithful,2,weighted.mean,T[,2]),
sigma1= cov.wt(faithful,T[,1])$cov,
sigma2= cov.wt(faithful,T[,2])$cov)
#function to plot current data
plot.em <- function(theta){
mixture.contour <- outer(xpts,ypts,function(x,y) {
theta$tau[1]*dmvnorm(cbind(x,y),mean=theta$mu1,sigma=theta$sigma1) + theta$tau[2]*dmvnorm(cbind(x,y),mean=theta$mu2,sigma=theta$sigma2)
})
contour(xpts,ypts,mixture.contour,nlevels=5,drawlabel=FALSE,col="red",xlab="Eruption time (mins)",ylab="Waiting time (mins)",main="Waiting time vs Eruption time of the Old Faithful geyser")
points(faithful)
}
#plot initial contours
iter <- 1
png(filename=paste("em",formatC(iter,width=4,flag="0"),".png",sep=""))
plot.em(theta)
dev.off()
#run EM and plot
for (iter in 2:30){
T <- E.step(theta)
theta <- M.step(T)
png(filename=paste("em",formatC(iter,width=4,flag="0"),".png",sep=""))
plot.em(theta)
dev.off()
}
라이선스
나는 아래 작품의 저작권자로서, 이 저작물을 다음과 같은 라이선스로 배포합니다:
이 파일은 크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0 Unported 라이선스로 배포됩니다.
- 이용자는 다음의 권리를 갖습니다:
- 공유 및 이용 – 저작물의 복제, 배포, 전시, 공연 및 공중송신
- 재창작 – 저작물의 개작, 수정, 2차적저작물 창작
- 다음과 같은 조건을 따라야 합니다:
- 저작자표시 – 적절한 저작자 표시를 제공하고, 라이선스에 대한 링크를 제공하고, 변경사항이 있는지를 표시해야 합니다. 당신은 합리적인 방식으로 표시할 수 있지만, 어떤 방식으로든 사용권 허가자가 당신 또는 당신의 사용을 지지하는 방식으로 표시할 수 없습니다.
- 동일조건변경허락 – 만약 당신이 이 저작물을 리믹스 또는 변형하거나 이 저작물을 기반으로 제작하는 경우, 당신은 당신의 기여물을 원저작물과 동일하거나 호환 가능한 라이선스에 따라 배포하여야 합니다.
| GNU 자유 문서 사용 허가서 1.2판 또는 자유 소프트웨어 재단에서 발행한 이후 판의 규정에 따라 본 문서를 복제하거나 개작 및 배포할 수 있습니다. 본 문서에는 변경 불가 부분이 없으며, 앞 표지 구절과 뒷 표지 구절도 없습니다. 본 사용 허가서의 전체 내용은 GNU 자유 문서 사용 허가서 부분에 포함되어 있습니다.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
이 라이선스 중에서 목적에 맞는 것을 선택하여 사용할 수 있습니다.
설명
이 파일이 나타내는 바에 대한 한 줄 설명을 추가합니다
이 파일에 묘사된 항목
다음을 묘사함
23 3 2009
파일 역사
날짜/시간 링크를 클릭하면 해당 시간의 파일을 볼 수 있습니다.
| 날짜/시간 | 섬네일 | 크기 | 사용자 | 설명 | |
|---|---|---|---|---|---|
| 현재 | 2009년 3월 23일 (월) 18:10 | 360 × 360 (272 KB) | wikimediacommons>3mta3 | A bit smaller |
이 파일을 사용하는 문서
다음 문서 1개가 이 파일을 사용하고 있습니다:
