www.b2bchain.cn

# 【算法模型】S07E08 EM算法（上）：含有隐变量的参数估计问题求职学习资料

$$mu_{mle}=frac{1}{N}sum_{i=1}^{N}x_i\sigma^2_{mle}=frac{1}{N}sum_{i=1}^n(x_i-mu_{mle})^2$$

$$sigma^2=frac{1}{N-1}sum_{i=1}^n(x_i-mu_{mle})^2$$

$theta_A=frac{9+8+7}{30}=0.8$

$theta_B=frac{4+5}{20}=0.45$

$$theta_A^{(0)}=0.6，theta_B^{(0)}=0.5$$

$$theta_{A}^{(0)5}(1-theta_{A}^{(0)})^5=0.6^5cdot0.4^5=0.0007962624$$

$$theta_{B}^{(0)5}(1-theta_{B}^{(0)})^5=0.5^5cdot0.5^5=0.0009765625$$

$$P_{A1}=frac{0.6^5cdot0.4^5}{0.6^5cdot0.4^5+0.5^5cdot0.5^5}=0.45$$

$$P_{B1}=frac{0.5^5cdot0.5^5}{0.6^5cdot0.4^5+0.5^5cdot0.5^5}=0.55$$

1 $正:2.25quad负:2.25$ $正:2.75quad负:2.75$
2 $正:7.2quad负:0.8$ $正:1.8quad负:0.2$
3 $正:5.84quad负:1.46$ $正:2.16quad负:0.54$
4 $正:1.4quad负:2.1$ $正:2.6quad负:3.9$
5 $正:4.55quad负:1.95$ $正:2.45quad负:1.05$
$正:21.24quad负:8.56$ $正:11.76quad负:8.44$

$$theta_A^{(1)}=frac{21.24}{21.24+8.56}=0.71$$

$$theta_B^{(1)}=frac{11.76}{11.76+8.44}=0.58$$

“
import numpy as np

$$mu_{mle}=frac{1}{N}sum_{i=1}^{N}x_i\sigma^2_{mle}=frac{1}{N}sum_{i=1}^n(x_i-mu_{mle})^2$$

$$sigma^2=frac{1}{N-1}sum_{i=1}^n(x_i-mu_{mle})^2$$

$theta_A=frac{9+8+7}{30}=0.8$

$theta_B=frac{4+5}{20}=0.45$

$$theta_A^{(0)}=0.6，theta_B^{(0)}=0.5$$

$$theta_{A}^{(0)5}(1-theta_{A}^{(0)})^5=0.6^5cdot0.4^5=0.0007962624$$

$$theta_{B}^{(0)5}(1-theta_{B}^{(0)})^5=0.5^5cdot0.5^5=0.0009765625$$

$$P_{A1}=frac{0.6^5cdot0.4^5}{0.6^5cdot0.4^5+0.5^5cdot0.5^5}=0.45$$

$$P_{B1}=frac{0.5^5cdot0.5^5}{0.6^5cdot0.4^5+0.5^5cdot0.5^5}=0.55$$

1 $正:2.25quad负:2.25$ $正:2.75quad负:2.75$
2 $正:7.2quad负:0.8$ $正:1.8quad负:0.2$
3 $正:5.84quad负:1.46$ $正:2.16quad负:0.54$
4 $正:1.4quad负:2.1$ $正:2.6quad负:3.9$
5 $正:4.55quad负:1.95$ $正:2.45quad负:1.05$
$正:21.24quad负:8.56$ $正:11.76quad负:8.44$

$$theta_A^{(1)}=frac{21.24}{21.24+8.56}=0.71$$

$$theta_B^{(1)}=frac{11.76}{11.76+8.44}=0.58$$

“
import numpy as np

$$mu_{mle}=frac{1}{N}sum_{i=1}^{N}x_i\sigma^2_{mle}=frac{1}{N}sum_{i=1}^n(x_i-mu_{mle})^2$$

$$sigma^2=frac{1}{N-1}sum_{i=1}^n(x_i-mu_{mle})^2$$

$theta_A=frac{9+8+7}{30}=0.8$

$theta_B=frac{4+5}{20}=0.45$

$$theta_A^{(0)}=0.6，theta_B^{(0)}=0.5$$

$$theta_{A}^{(0)5}(1-theta_{A}^{(0)})^5=0.6^5cdot0.4^5=0.0007962624$$

$$theta_{B}^{(0)5}(1-theta_{B}^{(0)})^5=0.5^5cdot0.5^5=0.0009765625$$

$$P_{A1}=frac{0.6^5cdot0.4^5}{0.6^5cdot0.4^5+0.5^5cdot0.5^5}=0.45$$

$$P_{B1}=frac{0.5^5cdot0.5^5}{0.6^5cdot0.4^5+0.5^5cdot0.5^5}=0.55$$

1 $正:2.25quad负:2.25$ $正:2.75quad负:2.75$
2 $正:7.2quad负:0.8$ $正:1.8quad负:0.2$
3 $正:5.84quad负:1.46$ $正:2.16quad负:0.54$
4 $正:1.4quad负:2.1$ $正:2.6quad负:3.9$
5 $正:4.55quad负:1.95$ $正:2.45quad负:1.05$
$正:21.24quad负:8.56$ $正:11.76quad负:8.44$

$$theta_A^{(1)}=frac{21.24}{21.24+8.56}=0.71$$

$$theta_B^{(1)}=frac{11.76}{11.76+8.44}=0.58$$

“`
import numpy as np