$$x=(0,...,0,1,0,...)^T$$

$$\mu=(\mu_1,\mu_2,...,\mu_K)^T$$

$$p(x\mid \mu)=\prod_{k=1}^K\mu_k^{x_k}$$

### 一.多项分布¶

$$Mult(m_1,m_2,...,m_K\mid\mu,N)=\binom{N}{m_1m_2\cdots m_K}\prod_{k=1}^K\mu_k^{m_k}$$

$$\binom{N}{m_1m_2\cdots m_K}=\frac{N!}{m_1!m_2!\cdots m_K!}$$

#### 极大似然估计¶

$$\mu_k^{ML}=\frac{m_k}{N}$$

### 二.狄利克雷分布¶

$$Dir(\mu\mid\alpha)=\frac{\Gamma(\alpha_0)}{\Gamma(\alpha_1)\cdots\Gamma(\alpha_K)}\prod_{k=1}^K\mu_k^{\alpha_k-1}$$

#### 后验分布¶

$$p(\mu\mid\alpha,m)\propto p(m\mid\mu)p(\mu\mid\alpha)\propto\prod_{k=1}^K\mu_k^{\alpha_k+m_k-1}$$

$$p(\mu\mid\alpha,m)=Dir(\mu\mid\alpha+m)=\frac{\Gamma(N+\alpha_0)}{\Gamma(\alpha_1+m_1)\cdots\Gamma(\alpha_K+m_K)}\prod_{k=1}^K\mu_k^{\alpha_k+m_k-1}$$

#### 贝叶斯推断¶

$$p(x_k=1\mid m,\alpha)\\ =\int p(x_k=1\mid\mu)p(\mu\mid\alpha,m)d\mu\\ =\int\mu_k\frac{\Gamma(N+\alpha_0)}{\Gamma(\alpha_1+m_1)\cdots\Gamma(\alpha_K+m_K)}\prod_{i=1}^K\mu_i^{\alpha_i+m_i-1}d\mu\\ =\frac{\Gamma(N+\alpha_0)}{\Gamma(\alpha_1+m_1)\cdots\Gamma(\alpha_K+m_K)}\int\mu_k\prod_{i=1}^K\mu_i^{\alpha_i+m_i-1}d\mu\\ =\frac{\Gamma(N+\alpha_0)}{\Gamma(\alpha_1+m_1)\cdots\Gamma(\alpha_K+m_K)}\frac{\Gamma(\alpha_1+m_1)\cdots\Gamma(\alpha_k+m_k+1)\cdots\Gamma(\alpha_K+m_K)}{\Gamma(N+\alpha_0+1)}\\ =\frac{\Gamma(N+\alpha_0)}{\Gamma(\alpha_k+m_k)}\frac{\Gamma(\alpha_k+m_k+1)}{\Gamma(N+\alpha_0+1)}\\ =\frac{\alpha_k+m_k}{N+\alpha_0}$$
In [ ]: