京都大学 情報学研究科 知能情報学専攻 2021年8月実施 専門科目 S-3
Author
祭音Myyura
Description
2次元実数空間におけるデータ点 ( x , y ) (x, y) ( x , y ) が、確率密度関数 f ( x , y ) f(x, y) f ( x , y ) をもつ確率分布に従うとする。
この確率分布は、クラス A A A と B B B に対応する2つの確率分布の混合分布であり、それぞれが以下の確率密度関数をもつ:
f A ( x , y ) = 1 π exp ( − x 2 a − a y 2 ) , f B ( x , y ) = 1 π exp ( − ( x − 2 ) 2 − ( y − 3 ) 2 ) . f_A(x, y) = \frac{1}{\pi} \exp\left(-\frac{x^2}{a} - ay^2\right), \ f_B(x, y) = \frac{1}{\pi} \exp\left(-(x-2)^2 - (y-3)^2\right). f A ( x , y ) = π 1 exp ( − a x 2 − a y 2 ) , f B ( x , y ) = π 1 exp ( − ( x − 2 ) 2 − ( y − 3 ) 2 ) .
また、クラス A A A , B B B の事前確率(混合重み) p A , p B p_A, p_B p A , p B は、それぞれ
p A = 1 1 + exp ( b ) , p B = 1 − p A p_A = \frac{1}{1 + \exp(b)}, \quad p_B = 1 - p_A p A = 1 + exp ( b ) 1 , p B = 1 − p A
とする。なお、a a a は正の実数定数、b b b は実数定数とする。
設問1 クラス A A A に属することが予め分かっている3つのデータ点 ( 1 , 1 ) , ( 2 , 2 ) , ( 0 , 1 ) (1,1), (2,2), (0,1) ( 1 , 1 ) , ( 2 , 2 ) , ( 0 , 1 ) が与えられたときの、a a a の最尤推定値を求めよ。
設問2 a = 1 a = 1 a = 1 とする。あるデータ点 ( x , y ) (x, y) ( x , y ) がクラス A A A と B B B のいずれに属するかを、クラスの事後確率の大小を比較することで判定する。データ点 ( x , y ) (x, y) ( x , y ) がクラス A A A に属すると判定する条件を与えよ。
設問3 データ点 ( 1 , 1 ) (1,1) ( 1 , 1 ) がクラス A A A に属する事後確率が、クラス A A A の事前確率と一致する時の a a a の値を求めよ。
設問4 a = 0.5 a = 0.5 a = 0.5 とする。2つのデータ点 ( 0 , 0 ) , ( 1 , 2 ) (0,0), (1,2) ( 0 , 0 ) , ( 1 , 2 ) が観測されたときの、b b b の最尤推定値を求めよ。なお、exp ( − 10 ) ≈ 0 \exp(-10) \approx 0 exp ( − 10 ) ≈ 0 としてよい。
Kai
設問1
We only need to find the value of a a a that maximizes the log-joint likelihood function L ( a ) L(a) L ( a )
L ( a ) = ln ∏ i = 1 n { p A f A ( x i , y i ) + p B f B ( x i , y i ) } ∝ ln ∏ i = 1 n f A ( x i , y i ) = − n ln π − 1 a ∑ i = 1 n x i 2 − a ∑ i = 1 n y i 2 \begin{aligned}
L(a)
&= \ln \prod_{i=1}^{n}\left\{p_{A}f_{A}(x_{i},y_{i})+p_{B}f_{B}(x_{i},y_{i})\right\}\\
&\propto \ln \prod_{i=1}^{n}f_{A}(x_{i},y_{i})
= -n\ln \pi -\frac{1}{a}\sum_{i=1}^{n}x_{i}^{2}-a\sum_{i=1}^{n}y_{i}^{2}\\
\end{aligned} L ( a ) = ln i = 1 ∏ n { p A f A ( x i , y i ) + p B f B ( x i , y i ) } ∝ ln i = 1 ∏ n f A ( x i , y i ) = − n ln π − a 1 i = 1 ∑ n x i 2 − a i = 1 ∑ n y i 2
Then,
∂ L ( a ) ∂ a = 1 a 2 ∑ i = 1 n x i 2 − ∑ i = 1 n y i 2 = 0 ⇒ a = ∑ i = 1 n x i 2 ∑ i = 1 n y i 2 \frac{\partial L(a)}{\partial a}
= \frac{1}{a^{2}}\sum_{i=1}^{n}x_{i}^{2}-\sum_{i=1}^{n}y_{i}^{2} = 0 \Rightarrow a = \sqrt{\frac{\sum_{i=1}^{n}x_{i}^{2}}{\sum_{i=1}^{n}y_{i}^{2}}} ∂ a ∂ L ( a ) = a 2 1 i = 1 ∑ n x i 2 − i = 1 ∑ n y i 2 = 0 ⇒ a = ∑ i = 1 n y i 2 ∑ i = 1 n x i 2
Therefore, the maximum likelihood estimate of a a a is
a = 1 2 + 2 2 + 0 2 1 2 + 2 2 + 1 2 = 30 6 a = \sqrt{\frac{1^{2}+2^{2}+0^{2}}{1^{2}+2^{2}+1^{2}}} = \frac{\sqrt{30}}{6} a = 1 2 + 2 2 + 1 2 1 2 + 2 2 + 0 2 = 6 30
設問2
Let f A ′ ( x , y ) f'_A(x,y) f A ′ ( x , y ) and f B ′ ( x , y ) f'_B(x,y) f B ′ ( x , y ) denote the posterior class probabilities of a data point ( x , y ) (x,y) ( x , y ) belongs to A A A and B B B , resp.
Let P ( x , y ) P(x,y) P ( x , y ) denote the joint probability density function of x x x and y y y .
From the Bayes' theorem, we have
f A ′ ( x , y ) = f A ( x , y ) p A P ( x , y ) f B ′ ( x , y ) = f B ( x , y ) p B P ( x , y ) \begin{aligned}
f'_A(x,y) &= \frac{f_A(x,y)p_A}{P(x,y)}\\
f'_B(x,y) &= \frac{f_B(x,y)p_B}{P(x,y)}
\end{aligned} f A ′ ( x , y ) f B ′ ( x , y ) = P ( x , y ) f A ( x , y ) p A = P ( x , y ) f B ( x , y ) p B
by comparing the posterior class probabilities we have
f A ( x , y ) p A > f B ( x , y ) p b ⇒ 1 π ( 1 + e b ) e − x 2 a − a y 2 > e b π ( 1 + e b ) e − ( x − 2 ) 2 − ( y − 3 ) 2 f_A(x,y) p_A > f_B(x,y) p_b \Rightarrow
\frac{1}{\pi(1+e^{b})}e^{-\frac{x^2}{a} - ay^2} >\frac{e^{b}}{\pi(1+e^{b})}e^{-(x-2)^{2}-(y-3)^{2}} f A ( x , y ) p A > f B ( x , y ) p b ⇒ π ( 1 + e b ) 1 e − a x 2 − a y 2 > π ( 1 + e b ) e b e − ( x − 2 ) 2 − ( y − 3 ) 2
by set a = 1 a = 1 a = 1 we have
1 π ( 1 + e b ) e − x 2 − y 2 > e b π ( 1 + e b ) e − ( x − 2 ) 2 − ( y − 3 ) 2 \frac{1}{\pi(1+e^{b})}e^{-x^{2}-y^{2}} >\frac{e^{b}}{\pi(1+e^{b})}e^{-(x-2)^{2}-(y-3)^{2}} π ( 1 + e b ) 1 e − x 2 − y 2 > π ( 1 + e b ) e b e − ( x − 2 ) 2 − ( y − 3 ) 2
which can be simplied to
6 y + 2 x + b − 13 < 0 6y+2x+b-13 < 0 6 y + 2 x + b − 13 < 0
設問3
Since the prior probability and posterior probability is equal, we have
f A ′ ( x , y ) = f A ( x , y ) p A P ( x , y ) = p A f'_A(x,y) = \frac{f_A(x,y)p_A}{P(x,y)} = p_A f A ′ ( x , y ) = P ( x , y ) f A ( x , y ) p A = p A
which implies that
f A ( x , y ) = P ( x , y ) . f_A(x,y) = P(x, y). f A ( x , y ) = P ( x , y ) .
Note that P ( x , y ) = p A f A ( x , y ) + p B f B ( x , y ) P(x,y) = p_{A}f_{A}(x,y)+p_{B}f_{B}(x,y) P ( x , y ) = p A f A ( x , y ) + p B f B ( x , y ) , hence
( 1 − p A ) f A ( x , y ) = ( 1 − p A ) f B ( x , y ) (1-p_{A})f_{A}(x,y) = (1-p_{A})f_{B}(x,y) ( 1 − p A ) f A ( x , y ) = ( 1 − p A ) f B ( x , y )
i.e., f A ( x , y ) = f B ( x , y ) f_A(x,y) = f_B(x,y) f A ( x , y ) = f B ( x , y ) , which implies that
− x 2 a − a y 2 = − ( x − 2 ) 2 − ( y − 3 ) 2 \begin{align}
-\frac{x^{2}}{a}-ay^{2} = -(x-2)^{2}-(y-3)^{2} \tag{i}
\end{align} − a x 2 − a y 2 = − ( x − 2 ) 2 − ( y − 3 ) 2 ( i )
solving (i) by substituting ( x , y ) = ( 1 , 1 ) (x,y) = (1,1) ( x , y ) = ( 1 , 1 ) , we have
a = 5 ± 21 2 a= \frac{5\pm \sqrt{21}}{2} a = 2 5 ± 21
設問4
The objective is
T ( b ) = ln ∏ i = 1 n f ( x i , y i ) = ln ∏ i = 1 n ( p A f A ( x i , y i ) + p B f B ( x i , y i ) ) = ∑ i = 1 n ln ( p A f A ( x i , y i ) + p B f B ( x i , y i ) ) \begin{aligned}
T(b) &= \ln \prod_{i=1}^{n}f(x_{i},y_{i})\\
&= \ln \prod_{i=1}^{n}\left(p_{A}f_{A}(x_{i},y_{i})+p_{B}f_{B}(x_{i},y_{i})\right)\\
&= \sum_{i=1}^{n} \ln \left(p_{A}f_{A}(x_{i},y_{i})+p_{B}f_{B}(x_{i},y_{i})\right)\\
\end{aligned} T ( b ) = ln i = 1 ∏ n f ( x i , y i ) = ln i = 1 ∏ n ( p A f A ( x i , y i ) + p B f B ( x i , y i ) ) = i = 1 ∑ n ln ( p A f A ( x i , y i ) + p B f B ( x i , y i ) )
by solving the following equations (note that when a = 0.5 a = 0.5 a = 0.5 , we have f A ( 0 , 0 ) = 1 / π f_{A}(0,0)=1/\pi f A ( 0 , 0 ) = 1/ π , f A ( 1 , 2 ) = e − 4 / π f_{A}(1,2)=e^{-4}/\pi f A ( 1 , 2 ) = e − 4 / π , f B ( 0 , 0 ) = e − 13 / π ≈ 0 f_{B}(0,0)=e^{-13}/\pi\approx 0 f B ( 0 , 0 ) = e − 13 / π ≈ 0 , f B ( 1 , 2 ) = e − 2 / π f_{B}(1,2)=e^{-2}/\pi f B ( 1 , 2 ) = e − 2 / π .)
∂ T ( b ) ∂ b = e b 1 + e b ∑ i = 1 n − f A ( x i , y i ) + f B ( x i , y i ) f A ( x i , y i ) + e b f B ( x i , y i ) = 0 \begin{aligned}
\frac{\partial T(b)}{\partial b}
&= \frac{e^{b}}{1+e^{b}}\sum_{i=1}^{n}\frac{-f_{A}(x_{i},y_{i})+f_{B}(x_{i},y_{i})}{f_{A}(x_{i},y_{i})+e^{b}f_{B}(x_{i},y_{i})} = 0
\end{aligned} ∂ b ∂ T ( b ) = 1 + e b e b i = 1 ∑ n f A ( x i , y i ) + e b f B ( x i , y i ) − f A ( x i , y i ) + f B ( x i , y i ) = 0
we have
− e − 4 + e − 2 e − 4 + e b − 2 = 1 ⇒ b = ln ( e 2 − 2 ) − 2 \frac{-e^{-4}+e^{-2}}{e^{-4}+e^{b-2}} = 1 \Rightarrow b = \ln(e^{2}-2)-2 e − 4 + e b − 2 − e − 4 + e − 2 = 1 ⇒ b = ln ( e 2 − 2 ) − 2