【Machine Learning】逻辑回归 Logistic Regression
来源:互联网 发布:jquery.uploadify.js 编辑:程序博客网 时间:2024/05/01 04:39
【公式】
s形函数:
【Logistic regression cost function】
重申:cost function表示预测值和实际值的平方差
设
hθ(x)之前已经定义,由于y只能等于1或者0,则J(θ) 可变型如下
那What should do Next is find out minθJ(θ)的 θ 值了
如前几章所讲,由求导求出最小的值
【求导步骤】
先贴一张链式法则求三层以上的复合函数的导数:
然后J(θ)可以变形成
带入公式,再求导可以得出:
设 则有:
将g1带入公式
将k g(θ)带入
【Useful Function】
matlab中已经帮我们做好了优化 θ 的辅助函数,我们只要写好cost function并告诉系统就可以了
jVal 是 cost function 的表示,比如设有两个点(1,0,5)和(0,1,5)进行回归,那么就设方程为hθ(x)=θ1x1+θ2x2;
则有costfunction J(θ): jVal=(theta(1)-5)^2+(theta(2)-5)^2;
在每次迭代中,按照gradient descent的方法更新参数θ:θ(i)-=gradient(i),其中gradient(i)是J(θ)对θi求导的函数式,在此例中就有gradient(1)=2*(theta(1)-5), gradient(2)=2*(theta(2)-5)。如下面代码所示:
【Run】
- options = optimset('GradObj','on','MaxIter',100);
- initialTheta = zeros(2,1)
- [optTheta,functionVal,exitFlag] = fminunc(@costFunction,initialTheta,options);
‘GradObj’, Use the GradObj option to specify that FUN also returns a second output argument G that is the partial derivatives of the function df/dX, at the point X.
[theta, cost] = fminunc(@(t)(costFunction(t, X, y)), initialtheta, options);
@(t) ( costFunction(t, X, y) ) . This creates a function, with argument t, which calls your costFunction.
来源: <http://blog.csdn.net/abcjennifer/article/details/7716281>
来源: <http://feature-space.com/en/post24.html>
- 【Machine Learning】逻辑回归 Logistic Regression
- Machine Learning逻辑回归(Logistic Regression)
- 3、Logistic Regression 逻辑回归 [Stanford - Machine Learning]
- Coursera-Machine Learning 之 Logistic Regression (逻辑回归)-0x01
- Coursera-Machine Learning 之 Logistic Regression (逻辑回归)-0x02
- Machine Learning - VI. Logistic Regression逻辑回归 (Week 3)
- [Machine Learning]4.逻辑回归(logistic regression)
- [笔记]机器学习(Machine Learning) - 02.逻辑回归(Logistic Regression)
- Machine Learning——Logistic Regression(逻辑回归)
- 《Machine Learning in Action》 读书笔记之四:逻辑回归(logistic regression)
- 机器学习(Machine Learning)心得体会(2)逻辑回归Exercise 2:Logistic Regression
- Coursera Machine Learning 课程笔记之第三周:逻辑回归(Logistic Regression)
- 机器学习 Machine Learning(by Andrew Ng)----第四章 逻辑回归(Logistic Regression)
- Machine Learning:Logistic Regression
- [Machine Learning]--Logistic Regression
- Machine Learning--logistic regression
- Machine Learning:Logistic Regression
- logistic regression 逻辑回归
- UITabView
- A*寻路算法讲解+源码DEMO演示
- [jQuery] 2.2层级选择器(包含选择器,子选择器,相邻选择器,兄弟选择器)
- 《C和指针》读书笔记(10)
- C++中函数覆盖和使用虚函数有什么区别
- 【Machine Learning】逻辑回归 Logistic Regression
- HDU2037——今年暑假不AC
- 基于X的GNOME、GTK、GDK、XLib、GLib等之间的关系
- JVM基础研究整理之七--典型配置举例1
- tomcat运行期优化及问题解决方案
- Linux挂载光驱出现错误:can't find /mnt/cdrom in /etc/fstable or /etc/mtab 解决方法:
- 字符串匹配(BF,KMP,BM)
- Dnn中无法在中等信任级别使用AutoMapper
- Linux 正则表示法和文件格式化处理