매개변수 추정

R로 배우는 Mixture Models

Victor Medina

Researcher at The University of Edinburgh

head(data)
         x
1 3.294453
2 5.818586
3 2.380493
4 4.415913
5 5.048659
6 4.750195

R로 배우는 Mixture Models

가정

  1. 어떤 분포? $\rightarrow$ 가우시안 분포 $\checkmark$
  2. 클러스터 수? $\rightarrow$ 2개 $\checkmark$
  3. 어떤 매개변수?
    • 평균 2개
    • 비율 2개
    • 표준편차 2개 $\rightarrow$ 모두 1 $\checkmark$

$\Rightarrow$ 추정할 매개변수 4개! (평균 2개, 비율 2개)

R로 배우는 Mixture Models

1 알려진 확률 $\rightarrow$

평균과 비율 추정

2 알려진 평균과 비율 $\rightarrow$

확률 추정

R로 배우는 Mixture Models

1단계: 알려진 확률

head(data_with_probs)
         x prob_red prob_blue
1 3.294453     0.64      0.36
2 5.818586     0.01      0.99
3 2.380493     0.92      0.08
4 4.415913     0.16      0.84
5 5.048659     0.05      0.95
6 4.750195     0.09      0.91

R로 배우는 Mixture Models

평균의 경우

means_estimates <- data_with_probs %>%
   summarise(mean_red = sum(x * prob_red) / sum(prob_red),
             mean_blue = sum(x * prob_blue) / sum(prob_blue))
means_estimates
  mean_red mean_blue
1  2.86925  5.062976

비율의 경우

proportions_estimates <- data_with_probs %>% 
   summarise(proportion_red = mean(prob_red),
             proportion_blue = 1 - proportion_red)
proportions_estimates
  proportion_red proportion_blue
1          0.305           0.695
R로 배우는 Mixture Models

R로 배우는 Mixture Models

2단계: 알려진 평균과 비율

R로 배우는 Mixture Models

R로 배우는 Mixture Models

R로 배우는 Mixture Models

R로 배우는 Mixture Models

2단계: 스케일링된 확률

$\text{Probability}_{\text{ blue}}=\frac{0.065}{0.115 + 0.065}=0.36$

data %>% 
   mutate(prob_from_red = 0.3 * dnorm(x, mean = 3),
          prob_from_blue = 0.7 * dnorm(x,mean = 5),
          prob_red = prob_from_red/(prob_from_red + prob_from_blue),
          prob_blue = prob_from_blue/(prob_from_red + prob_from_blue)) %>% 
   select(x, prob_red, prob_blue) %>% head(4)
         x   prob_red  prob_blue
1 3.294453 0.63733037 0.36266963
2 5.818586 0.01115698 0.98884302
3 2.380493 0.91619343 0.08380657
4 4.415913 0.15721146 0.84278854
R로 배우는 Mixture Models

요약

  • 확률을 알 때 $\rightarrow$ 평균과 비율 추정
  • 평균과 비율을 알 때 $\rightarrow$ 확률 추정

R로 배우는 Mixture Models

연습해 봅시다!

R로 배우는 Mixture Models

Preparing Video For Download...