逻辑回归 (Logistic Regression)
Hypothesis
具有 $m$ 个样本(samples)与 $n$ 个特征(features)的线性回归的hypothesis为:
$$ \begin{equation}h_\theta(x)={1\over 1+e^{-\theta^Tx}}={1\over 1+e^{-{(\theta_0+\theta_1x_1+\theta_2x_2+\cdots+\theta_nx_n)}}}\end{equation} $$
Cost function
$$ \begin{equation}J(\theta)=-{1\over m}\sum_{i=1}^m{(y^{(i)}log(h_\theta(x^{(i)}))+(1-y^{(i)})log(1-h_\theta(x^{(i)})))}\end{equation} $$
Gradient Descent
$$ \begin{equation}\theta_j := \theta_j – \alpha{1\over m}\sum_{i=1}^m(h_\theta(x^{(i)})-y^{(i)})x^{(i)}_j\end{equation} $$
使用上述公式同时更新$\theta_0,\theta_1,\cdots,\theta_n$,其中$x^{(i)}_0=1$