Machine Learning 第三周
ML week3 逻辑回归
Logistic Function
h_\theta(x)=g(\theta^Tx)
g(t)=\frac{1}{1+e^{-z}}

当t大于0, 即下面公式成立时,y=1
\frac{1}{1+e^{-{\theta^Tx}}}>0.5 => {\theta^Tx}>0
关于theta与数据
y(x)=\theta_0+\theta_1x1+\theta_2x2
y(x)=\theta_0+\theta_1x_1+\theta_2x_2+\theta_3 x_1^2+\theta_4x_1x_2+\theta_5x_2^2
Cost function
由于使用线性回归的cost function会产生波浪形而达不到global最优点,所以使用新的方程
Cost(h_\theta(x),y) = -ylog(h_\theta(x))-(1-y)log(h_\theta(x))
多项式形式


矩阵形式

梯度下降算法

矩阵形式

使用其他更快的算法
function [jVal, gradient] = costFunction(theta)
jVal = [...code to compute J(theta)...];
gradient = [...code to compute derivative of J(theta)...];
end
options = optimset('GradObj', 'on', 'MaxIter', 100);
initialTheta = zeros(2,1);
[optTheta, functionVal, exitFlag] = fminunc(@costFunction, initialTheta, options);
当y不止0,1时
如:天气有cloudy rainy sunny

问题:画出的线重复怎么办

过拟合


1)减少的特征:
- 手动选择特征来保持。
- 使用模型选择算法进行。(介绍 )
2)正规化
- 保持所有的特征,但减小的幅度的参数θJ。
- 正则化时,我们有许多稍微有益的特征
梯度下降防止过拟合
改变cost function

而梯度下降会变为

正规方程防止过拟合

Machine Learning 第三周的更多相关文章
- Hand on Machine Learning第三章课后作业(1):垃圾邮件分类
import os import email import email.policy 1. 读取邮件数据 SPAM_PATH = os.path.join( "E:\\3.Study\\机器 ...
- Machine Learning - 第6周(Advice for Applying Machine Learning、Machine Learning System Design)
In Week 6, you will be learning about systematically improving your learning algorithm. The videos f ...
- Machine Learning - 第3周(Logistic Regression、Regularization)
Logistic regression is a method for classifying data into discrete outcomes. For example, we might u ...
- Machine Learning第十一周笔记:photo OCR
博客已经迁移至Marcovaldo's blog (http://marcovaldong.github.io/) 刚刚完毕了Cousera上Machine Learning的最后一周课程.这周介绍了 ...
- Machine Learning – 第2周(Linear Regression with Multiple Variables、Octave/Matlab Tutorial)
Machine Learning – Coursera Octave for Microsoft Windows GNU Octave官网 GNU Octave帮助文档 (有900页的pdf版本) O ...
- Machine Learning 第一二周
# ML week 1 2 一.关于machine learning的名词 学习 从无数数据提供的E:experience中找到一个函数使得得到T:task后能够得到P:prediction 监督学习 ...
- Machine Learning第十周笔记:大规模机器学习
博客已经迁移到Marcovaldo's blog (http://marcovaldong.github.io/) 刚刚完毕了Andrew Ng在Cousera上的Machine Learning的第 ...
- 吴恩达《深度学习》-第一门课 (Neural Networks and Deep Learning)-第三周:浅层神经网络(Shallow neural networks) -课程笔记
第三周:浅层神经网络(Shallow neural networks) 3.1 神经网络概述(Neural Network Overview) 使用符号$ ^{[
- Machine Learning - 第7周(Support Vector Machines)
SVMs are considered by many to be the most powerful 'black box' learning algorithm, and by posing构建 ...
随机推荐
- 修改Ueditor的图片上传地址
文件地址:ueditro/php/config.json /* 前后端通信相关的配置,注释只允许使用多行方式 */ { /* 上传图片配置项 */ "imageActionName" ...
- 根据浏览器判断是下载IOS还是其它的手机安装包
http://tiao.67767.cn/DownLoad.aspx?cid=3509 <!DOCTYPE html> <html> <hea ...
- vue 安装及使用
一, vue.js 2.0 1, cnpm install vue-cli -g 全局安装 2, 运行vue查看安装是否成功(创建vue-cli目录: vue init webpack demo) ...
- centos7安装python3 以及tab补全功能
1.安装python3 1.1下载python源码包 网址:https://www.python.org/downloads/release/python-362/ 下载地址:https://www. ...
- mysql 插入百万条数据
利用mysql内存表插入速度快的特点,先存储过程在内存表中生成数据,然后再从内存表插入普通表中 一.创建内存表 CREATE TABLE `vote_record_memory` ( `id` ) N ...
- 太原面经分享:如何用js实现返回斐波那契数列的第n个值的函数
面试攒经验,let's go! 值此高考来临之际,闲不住的我又双叒叕出发去面试攒经验了,去了公司交待一番流程后,面试官甩给了我一张A4纸,上面写着一道js算法笔试题(一开始我并不知道这是在考察js算法 ...
- Linux下卸载Oracle 11g
第一种方法: 使用oracle自带的runInstaller 卸载 [oracle@VM_0_14_centos deinstall]$ cd $ORACLE_HOME [oracle@VM_0_14 ...
- android 自定义Button,抛弃写shape文件
标签: android 控件 自定义 2017年05月27日 17:52:13 611人阅读 评论(0) 收藏 举报 分类: 自定义View(2) 作者同类文章 X 版权声明:本文为博主原创文章 ...
- HTTP 错误 405.0 - Method Not Allowed 无法显示您正在查找的页面,因为使用了无效方法(HTTP 谓词)。
x 前言:报错信息 HTTP 错误 405.0 - Method Not Allowed 无法显示您正在查找的页面,因为使用了无效方法(HTTP 谓词). 发送至 Web 服务器的请求使用了为处理该请 ...
- 微信小程序 组件 Demo
文字跑马灯效果: http://www.wxapp-union.com/portal.php?mod=view&aid=1038 触摸水波涟漪效果: http://www.wx ...