Skip to content

Latest commit

 

History

History
43 lines (22 loc) · 2.13 KB

机器学习的常用符号和公式的代码.md

File metadata and controls

43 lines (22 loc) · 2.13 KB

机器学习的常用符号和公式的代码:

$\left( {{x}{1}},{{x}{1}},...,{{x}_{n}} \right)$

${{x}^{\left( i \right)}}$

$\mathop{x}_{j}^{\left( i \right)}$

$z={{\theta }^{T}}x$

计算代价函数 $J\left( \theta \right)=\frac{1}{2m}\sum\limits_{i=1}^{m}{{{\left( {{h}{\theta }}\left( {{x}^{(i)}} \right)-{{y}^{(i)}} \right)}^{2}}}$ 其中:${{h}{\theta }}\left( x \right)={{\theta }^{T}}X={{\theta }{0}}{{x}{0}}+{{\theta }{1}}{{x}{1}}+{{\theta }{2}}{{x}{2}}+...+{{\theta }{n}}{{x}{n}}$

代码:

${{\theta }^{T}}x$

${{h}_{\theta }}\left( x \right)=P\left( y=1|x;\theta \right)$

$\frac{\partial }{\partial {{\theta }{j}}}J\left( {{\theta }{j}} \right)=0$ 。 $\theta ={{\left( {{X}^{T}}X \right)}^{-1}}{{X}^{T}}y$

$g\left( z \right)=\frac{1}{1+{{e}^{-z}}}$

${{h}_{\theta }}\left( x \right)$

$J\left( \theta \right)=\frac{1}{m}\sum\limits_{i=1}^{m}{\frac{1}{2}{{\left( {{h}{\theta }}\left( \mathop{x}^{\left( i \right)} \right)-\mathop{y}^{\left( i \right)} \right)}^{2}}}$ $J\left( \theta \right)=\frac{1}{m}\sum\limits{i=1}^{m}{\operatorname{Cos}t\left( {{h}_{\theta }}\left( \mathop{x}^{\left( i \right)} \right),\mathop{y}^{\left( i \right)} \right)}$

$Cost\left( {{h}_{\theta }}\left( x \right),y \right)$

$Cost\left( {{h}{\theta }}\left( x \right),y \right)=-y\times log\left( {{h}{\theta }}\left( x \right) \right)-(1-y)\times log\left( 1-{{h}_{\theta }}\left( x \right) \right)$

$J\left( \theta \right)=\frac{1}{m}\sum\limits_{i=1}^{m}{[-{{y}^{(i)}}\log \left( {{h}{\theta }}\left( {{x}^{(i)}} \right) \right)-\left( 1-{{y}^{(i)}} \right)\log \left( 1-{{h}{\theta }}\left( {{x}^{(i)}} \right) \right)]}$ $J\left( \theta \right)=-\frac{1}{m}\sum\limits_{i=1}^{m}{[{{y}^{(i)}}\log \left( {{h}{\theta }}\left( {{x}^{(i)}} \right) \right)+\left( 1-{{y}^{(i)}} \right)\log \left( 1-{{h}{\theta }}\left( {{x}^{(i)}} \right) \right)]}$

$J\left( \theta \right)=\frac{1}{m}\sum\limits_{i=1}^{m}{[-{{y}^{(i)}}\log \left( {{h}{\theta }}\left( {{x}^{(i)}} \right) \right)-\left( 1-{{y}^{(i)}} \right)\log \left( 1-{{h}{\theta }}\left( {{x}^{(i)}} \right) \right)]}+\frac{\lambda }{2m}\sum\limits_{j=1}^{n}{\theta _{j}^{2}}$