Machine Learning - week 3 - Overfitting
The Problem of Overfitting
如果有太多的 features,假设可能与训练数据太匹配了以致于预测未来的数据不准确。如下图:

解决 overfitting
1. 既然是由太多的 features 引起的,那么就排除一些 features
2. Regularization
不变动 features,因为 features 也是带有信息的,但是减少 θj 的数量级
Regularization Cost Function
Regularization
各个 θ 的参数越小,那么 h(θ) 会越简单,更不会 overfitting;

λ 叫做 regularization parameter,用来调节 regularization。注意,这里 j 是从 1 开始,所以 θ0 不需要包括进来。
如果 λ 很小,那我就当它为 0,会造成 overfitting;
如果 λ 很大,那么 θ 就会接近 0,然后是一条直线(θ0),造成 underfitting。
Regularized Linear Regression
J(θ)
只需要在 α 中加上 (θj / m ) * λ

Gradient descent
化简后,为
,因为 1 - αλ/m < 1,所以 θ 是一直减小的。
对 Normal Equation 使用,公式如下

Regularized Logistic Regression
J(θ)
与上方的一样,加上,在 α 中加上 (θj / m ) * λ,变成

Gradient Descent
与上方的一样。
所以这里与上面是一样的,只是 h(θ) 不同。

Advanced optimization
与之前一样。计算 J(θ) 、gradient 的方程,这里替换过去就可以。
Machine Learning - week 3 - Overfitting的更多相关文章
- 【Machine Learning】决策树案例:基于python的商品购买能力预测系统
决策树在商品购买能力预测案例中的算法实现 作者:白宁超 2016年12月24日22:05:42 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现的深入理解.本 ...
- 【机器学习Machine Learning】资料大全
昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...
- Machine Learning Algorithms Study Notes(2)--Supervised Learning
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- 机器学习(Machine Learning)&深度学习(Deep Learning)资料
<Brief History of Machine Learning> 介绍:这是一篇介绍机器学习历史的文章,介绍很全面,从感知机.神经网络.决策树.SVM.Adaboost到随机森林.D ...
- Advice for applying Machine Learning
https://jmetzen.github.io/2015-01-29/ml_advice.html Advice for applying Machine Learning This post i ...
- Common Pitfalls In Machine Learning Projects
Common Pitfalls In Machine Learning Projects In a recent presentation, Ben Hamner described the comm ...
- Practical Machine Learning For The Uninitiated
Practical Machine Learning For The Uninitiated Last fall when I took on ShippingEasy's machine learn ...
- Machine Learning Methods: Decision trees and forests
Machine Learning Methods: Decision trees and forests This post contains our crib notes on the basics ...
- 机器学习(Machine Learning)&深入学习(Deep Learning)资料
<Brief History of Machine Learning> 介绍:这是一篇介绍机器学习历史的文章,介绍很全面,从感知机.神经网络.决策树.SVM.Adaboost 到随机森林. ...
随机推荐
- 《算法 (第4版)》【PDF】下载
<算法 (第4版)>[PDF]下载链接: https://u253469.ctfile.com/fs/253469-231196349 (第4版)>[PDF]" TITL ...
- JDK 1.8 源码阅读和理解
根据 一篇文章教会你,如何做到招聘要求中的“要有扎实的Java基础” 的指引,决定开始阅读下JDK源码. 本文将作为源码阅读总纲 一.精读部分 java.io java.lang java.util ...
- php编码的一些小规范
本文同时发表在https://github.com/zhangyachen/zhangyachen.github.io/issues/104 最近在整理线上的hhvm warning,虽然每天产生百万 ...
- mysql case when group by实例
mysql 中类似php switch case 的语句. select xx字段, case 字段 when 条件1 then 值1 when 条件2 then 值2 else 其他值 END 别名 ...
- golang社区
a development list for Go Programming Language https://groups.google.com/forum/#!forum/golang-dev a ...
- 顶点/片元 shader 总结
Cg顶点程序必须在结构中传递顶点数据.几种常用的顶点结构定义在文件UnityCG.cginc中,有如下三种结构体: 1.appdata_base: 包含顶点位置,法线和一个纹理坐标.2.appdata ...
- axios配合vue+webpack使用
1.安装引用: cnpm install axios --save-dev 2.在组件中引入: import axios from 'axios'; 3.使用示例: 执行GET请求: // 为给定 I ...
- python2 与python3的变化
1 写文件如果是bytes类型的话,打开文件 open参数设置为wb 2 python2 默认包import是相对路径,python3是绝对路径 3 python3的dict没有has_key方法,用 ...
- Android 执行 adb shell 命令
Android 执行Adb shell 命令大多需要root权限,Android自带的Runtime. getRuntime().exec()容易出错,在网上找到了一个执行adb shell命令的类 ...
- java log4j基本配置及日志级别配置详解
java log4j日志级别配置详解 1.1 前言 说出来真是丢脸,最近被公司派到客户公司面试外包开发岗位,本来准备了什么redis.rabbitMQ.SSM框架的相关面试题以及自己做过的一些项目回顾 ...