逻辑回归的向量化实现样例
From Ufldl
Line 17: | Line 17: | ||
【原文】: | 【原文】: | ||
- | where (following the notational convention from the OpenClassroom videos and from CS229) we let <math> | + | where (following the notational convention from the OpenClassroom videos and from CS229) we let <math>\textstyle x_0=1</math>, so that <math>x\in R^{n+1}</math> and <math>\theta \in R^{n+1}</math>, and <math>\textstyle \theta_0</math> is our intercept term. We have a training set{(<math>x^\left( 1\right) </math>,<math>y^\left( 1\right)</math> ) ,...,(<math>x^\left( m\right)</math> ,<math>y^\left( m\right)</math> ) } of m examples, and the batch gradient ascent update rule is <math>\theta :=\theta +\alpha \nabla _{\theta }l\left( \theta \right) </math> , where <math>l\left( \theta \right) </math> is the log likelihood and <math>\nabla _{\theta }l\left( \theta \right) </math> is its derivative. |
【初译】: | 【初译】: | ||
- | 设 <math> | + | 设 <math>\textstyle x_0=1</math>(符号规范遵从公开课程视频与CS229教学讲义),于是 <math>x\in R^{n+1}</math> , <math>\theta \in R^{n+1}</math>, <math>\textstyle \theta_0</math>为截距。现在,我们有m组样本数据集 {(<math>x^\left( 1\right) </math>,<math>y^\left( 1\right)</math> ) ,...,(<math>x^\left( m\right)</math> ,<math>y^\left( m\right)</math> ) },而批量梯度上升法的规则是: <math>\theta :=\theta +\alpha \nabla _{\theta }l\left( \theta \right) </math> ,这里的<math>l\left( \theta \right) </math> 是对数似然函数,<math>\nabla _{\theta }l\left( \theta \right) </math> 它的导函数。 |
【一校】: | 【一校】: | ||
- | 设 <math> | + | 设 <math>\textstyle x_0=1</math>(符号规范遵从公开课程视频与CS229教学讲义),于是<math>x\in R^{n+1}</math> ,<math>\theta \in R^{n+1}</math>, <math>\textstyle \theta_0</math> 为截距。我们有m个训练样本{(<math>x^\left( 1\right) </math>,<math>y^\left( 1\right)</math> ) ,...,(<math>x^\left( m\right)</math> ,<math>y^\left( m\right)</math> ) },而批量梯度上升法的更新法则是: <math>\theta :=\theta +\alpha \nabla _{\theta }l\left( \theta \right) </math> ,这里的 <math>l\left( \theta \right) </math> 是对数似然函数,<math>\nabla _{\theta }l\left( \theta \right) </math> 是其导函数。 |
【原文】: | 【原文】: |