广义线性模型之logistic regression(二)
来源:互联网 发布:c语言视频下载 编辑:程序博客网 时间:2024/06/05 21:56
注:本文若没特殊声明,所有截图均来自cs229 Machine Learning Lecture notes 1
Logistic regression的hypotheses为
其中
被称为logistic function或者sigmoid function。
由于 sigmoid 函数的输出介于0~1之间,因此我们可以把它看成概率。令则p(y|X;theta)的概率可写成
对求和符号内的式子求导得
我们发现,最终得到的参数更新公式与linear regression的是一样的:
从后续可知这并不是一个巧合。不过先来看看另一种求解方法,牛顿迭代法(Newton’s method)。
牛顿迭代法(Newton’s method)
我们知道,要求f(theta)=0,我们可以使用牛顿迭代法如下更新theta:
下图能给出一个形象的例子:
类似地,若要求f’(theta)=0,可以使用
扩展到多维的情况,即对应
利用该式子求解模型的方法也叫,Newton-Raphson method。其中
from [3]
可以证明上述的海森矩阵是半负定的(negative semi-definite),即
from [3]
因此,logistic不存在局部最优解,所以可以使用Newton’s method,此时该算法有个专有的名字——IRLS。
过程如下(与上面稍微不同),令
from [2]
from [2]
其中π = sigmoid(X)。令
from [2]
根据牛顿迭代法,有如下更新公式:
from [2]
对应的python代码如下:
from [2]
参考文献:
[1] cs229 Machine Learning Lecture notes 1: "Supervised Learning, Discriminative Algorithms"
[2] CPSC 540: Logistic regression, IRLS and importance sampling
[3] cs229 problem set 1
0 0
- 广义线性模型之logistic regression(二)
- 广义线性模型与Logistic回归
- 机器学习(二)之Logistic Regression
- 理解线性回归(二)——Logistic Regression 回归
- 机器学习算法整理之Logistic Regression (LR) 逻辑斯谛回归 :分类方法(对数线性模型)
- 广义线性模型之线性回归(一)
- logistic regression(二项 logistic 与 多项logistic )
- 广义线性模型(三)
- 广义线性模型(GLM)
- 线性回归、logistic回归、广义线性模型——斯坦福CS229机器学习个人总结(一)
- 逻辑回归模型(logistic regression)
- Logistic regression回归模型
- Logistic Regression 模型简介
- Logistic Regression 模型简介
- Logistic Regression 模型简介
- Logistic Regression 模型简介
- Logistic Regression 模型简介
- Logistic Regression 模型简介
- 浏览器发送URL的编码特性
- 带指针参数的函数指针数组
- UI显示Bitmap整合前两章内容
- 设计模式之简单模式与策略模式
- ActiveMQ的消息重试机制
- 广义线性模型之logistic regression(二)
- struts1与struts2的区别
- Python print函数用法,print 格式化输出(python格式化输出)
- 9.文件与文件系统的压缩与打包
- lua语法
- 大神博客
- 10004 - Bicoloring(BFS)
- DICOM学习
- hdu 4396 More lumber is required (二维SPFA)