scikit-learn:3.5. Validation curves: plotting scores to evaluate models
參考:http://scikit-learn.org/stable/modules/learning_curve.html
estimator's generalization error can be decomposed in terms ofbias, variance and noise. The bias of
an estimator is its average error for different training sets. The variance of
an estimator indicates how sensitive it is to varying training sets. Noise is a property of the data.
首先介绍背景,进而引入本节要讲的内容。背景就是:
针对函数COS(1.5π x),分别使用不同的estimators fit the function:linear regression with polynomial features of degree 1, 4 and 15。结果图例如以下:
图一high bias,图二刚好,图三high variance。但,,,。这并非重点。。
。。。。。。
。。
。
重点是:对于一维的COS函数。能够通过绘图来辨别bias或variance。但对于高维的样例,不能通过绘图来识别。此时。以下要讲的内容就helpful了。。。
。
1、Validation curve
为了验证一个模型。我们须要一个scoring function(see Model evaluation: quantifying
the quality of predictions。翻译文章:http://blog.csdn.net/mmc2015/article/details/47121611)。而为了找到较好的超參数的组合。我们常使用grid search或类似方法 (seeGrid
Search: Searching for estimator parameters,翻译文章:http://blog.csdn.net/mmc2015/article/details/47100091) ,在grid search过程中,我们希望找到使validation sets最大的score相应的超參数组合。(注意,validation
sets一旦使用,对于模型就是有bias的,所以对于generalization,一定要再选择其它独立的test sets验证。
)
然而并非重点。
。。
。。
重点是,我们希望能够plot the influence of a single hyperparameter on the training score and the validation score,这样有助于分析estimator是否overfitting、underfitting。。
training score and the validation score都low,说明estimator underfittig;training score high but the validation score low,说明overfitting。training score and the validation score都high,说明效果比較好(上图告诉我们。參数gamma最好选择0.001-0.0001);training score low but the validation
score high,可能性不大。
(事实上该方法不是非常有用,由于模型不仅受一个參数的影响。还会受其它參数的综合影响,还是grid search靠谱;假设仅仅有一个參数。那么该方法比較好。
)
2、Learning curve
A learning curve
shows the validation and training score of an estimator
for varying numbers of training samples.
如上图。If both the validation score and the training score converge to a value that is too low with increasing size of the
training set, we will not benefit much from more training data.这时,须要考虑换estimator或者调參数。
如上图,If
the training score is much greater than the validation score for the maximum number of training samples, adding more training samples will most likely increase generalization.这时。须要考虑获取很多其它的samples。
上面几幅图的产生程序參考:
scikit-learn:3.5. Validation curves: plotting scores to evaluate models的更多相关文章
- scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类 (python代码)
scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类数据集 fetch_20newsgroups #-*- coding: UTF-8 -*- import ...
- (原创)(三)机器学习笔记之Scikit Learn的线性回归模型初探
一.Scikit Learn中使用estimator三部曲 1. 构造estimator 2. 训练模型:fit 3. 利用模型进行预测:predict 二.模型评价 模型训练好后,度量模型拟合效果的 ...
- (原创)(四)机器学习笔记之Scikit Learn的Logistic回归初探
目录 5.3 使用LogisticRegressionCV进行正则化的 Logistic Regression 参数调优 一.Scikit Learn中有关logistics回归函数的介绍 1. 交叉 ...
- Scikit Learn: 在python中机器学习
转自:http://my.oschina.net/u/175377/blog/84420#OSC_h2_23 Scikit Learn: 在python中机器学习 Warning 警告:有些没能理解的 ...
- Scikit Learn
Scikit Learn Scikit-Learn简称sklearn,基于 Python 语言的,简单高效的数据挖掘和数据分析工具,建立在 NumPy,SciPy 和 matplotlib 上.
- 深入了解数据校验:Java Bean Validation 2.0(JSR380)
每篇一句 吾皇一日不退役,尔等都是臣子 相关阅读 [小家Java]深入了解数据校验(Bean Validation):基础类打点(ValidationProvider.ConstraintDescri ...
- Java-Class-@I:org.springframework.validation.annotation.Validated
ylbtech-Java-Class-@I:org.springframework.validation.annotation.Validated 1.返回顶部 2.返回顶部 1. package ...
- Query意图分析:记一次完整的机器学习过程(scikit learn library学习笔记)
所谓学习问题,是指观察由n个样本组成的集合,并根据这些数据来预测未知数据的性质. 学习任务(一个二分类问题): 区分一个普通的互联网检索Query是否具有某个垂直领域的意图.假设现在有一个O2O领域的 ...
- Spring Boot奇怪的问题:The Bean Validation API is on the classpath but no implementation could be found
注意:此方法不能解决在项目上用了Hibernate Validator的问题. 错误如下: *************************** APPLICATION FAILED TO STAR ...
随机推荐
- ZOJ 2913 Bus Pass (近期的最远BFS HDU2377)
题意 在全部城市中找一个中心满足这个中心到全部公交网站距离的最大值最小 输出最小距离和满足最小距离编号最小的中心 最基础的BFS 对每一个公交网站BFS dis[i]表示编号为i的点到全部公交网 ...
- C# WebQQ协议群发机器人(二)
本文出处http://blog.csdn.net/zhujunxxxxx/ 如需转载请注明出处! 接着上一篇http://blog.csdn.net/zhujunxxxxx/article/detai ...
- iOS 8使用Touch ID进行身份认证
iOS 8的SDK开放了Touch ID的接口.从WWDC的视频中能够看到Touch ID应用在两个方面:用于Key Chain加密和用于授权.iOS 8正式版公布以后我们能够看到Evernote的i ...
- MVC的一些常用特性,持续更新中。。。
1. @MvcHtmlString.Create("<option value='1'>火星</option>") //渲染Html
- C#操作sql时注意点
①创建必要的索引 ②使用预编译查询 ③使用参数化sql会执行预编译,第一次执行的时候DBMS会为这个SQL语句进行查询优化并执行预编译 ④调整where子句中的连接顺序 ⑤DBMS一般次用自上而下的顺 ...
- Python3字符串 详解
Python3 字符串 字符串是 Python 中最常用的数据类型.我们可以使用引号('或")来创建字符串. 创建字符串很简单,只要为变量分配一个值即可. Python 访问字符串中的值 P ...
- 边框的使用,border-radius,box-shadow,border-image
<html> <head> <meta charset="UTF-8"> <title></ ...
- Pyhton学习——Day48
# 转载:http://www.cnblogs.com/yuanchenqi/articles/6437362.html#python关于mysql的API--pymysql模块# 执行sql语句# ...
- Pyhton学习——Day24
# #面向对象设计:# def dog(name,gender,type):# def jiao(dog):# print('One Dog[%s],wfwfwf'%dog['name'])# def ...
- css——定位
position absolute:绝对定位 1.以页面的左上角为原点 2.不保留原来的位置 3.z-index可以调整图层顺序 如果想实现以父级元素左上角为原点.则:父级相对,子级绝对 在子级绝对的 ...