Test mathjax newline.

dev
SJ2050cn 4 years ago
parent fcccc4f1d9
commit 16de235b4c

@ -22,11 +22,11 @@ g(z_i)=g(\theta_i^T \mathbf{x})=\frac{e^{\theta_i^T\mathbf{x}}}{\sum\limits_{j=1
$$ $$
构造似然函数,若有$m$个训练样本: 构造似然函数,若有$m$个训练样本:
$$ $$
\begin{align} \begin{aligned}
L(\Theta)&=p(\mathbf{y}|\mathbf{X};\Theta) \\ L(\Theta)&=p(\mathbf{y}|\mathbf{X};\Theta) \\\\
& = \prod\limits_{i=1}^{m} p(y^{i}|\mathbf{x}^{i};\Theta) \\ & = \prod\limits_{i=1}^{m} p(y^{i}|\mathbf{x}^{i};\Theta) \\\\
& = \prod_{i=1}^m h_{\theta_i}(\mathbf{x}) & = \prod_{i=1}^m h_{\theta_i}(\mathbf{x})
\end{align} \end{aligned}
$$ $$
对似然函数取对数,转换为: 对似然函数取对数,转换为:
$$ $$
@ -35,21 +35,21 @@ $$
对$log(h_{\theta_i}(\mathbf{x}))$求导得到: 对$log(h_{\theta_i}(\mathbf{x}))$求导得到:
$$ $$
\frac{\partial{log(h_{\theta_i}(\mathbf{x}))}}{\partial{z_k}}=\begin{cases} \frac{\partial{log(h_{\theta_i}(\mathbf{x}))}}{\partial{z_k}}=\begin{cases}
1-h_{\theta_k}(\mathbf{x}) & \text{ if } k=i \\ 1-h_{\theta_k}(\mathbf{x}) & \text{ if } k=i \\\\
-h_{\theta_k}(\mathbf{x}) & else -h_{\theta_k}(\mathbf{x}) & else
\end{cases} \end{cases}
$$ $$
转换后的似然函数对$\theta$求偏导,在这里我们以只有一个训练样本的情况为例: 转换后的似然函数对$\theta$求偏导,在这里我们以只有一个训练样本的情况为例:
$$ $$
\begin{align} \begin{aligned}
\frac{\partial}{\partial\theta_k}l(\Theta)&=\frac{\partial l(\Theta)}{\partial{z_k}}\cdot \frac{\partial z_k}{\partial \theta_k} \\ \frac{\partial}{\partial\theta_k}l(\Theta)&=\frac{\partial l(\Theta)}{\partial{z_k}}\cdot \frac{\partial z_k}{\partial \theta_k} \\\\
&=(y_k-h_{\theta_k}(\mathbf{x}))\mathbf{x} &=(y_k-h_{\theta_k}(\mathbf{x}))\mathbf{x}
\end{align} \end{aligned}
$$ $$
上式中$y_k$的表达式如下: 上式中$y_k$的表达式如下:
$$ $$
y_k=\begin{cases} y_k=\begin{cases}
1 & \text{ if } k=i \\ 1 & \text{ if } k=i \\\\
0 & else 0 & else
\end{cases} \end{cases}
$$ $$

Loading…
Cancel
Save