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 ...
随机推荐
- python2.7编码与解码
常见的编码 ASCII: 美国人发明的,只编码英文字母和符号,1个字节. GB2312: 中国人发明的,增加了中文汉字和符号,2个字节. Unicode: 为了把所有语言都统一到一套编码里,一般是2个 ...
- 用jquery实现隐藏列表表单的显示关闭切换以及Ajax方式改动提交相应的那一行的改动内容。
请勿盗版,转载请加上出处http://blog.csdn.net/yanlintao1 请勿盗版,转载请加上出处http://blog.csdn.net/yanlintao1 先给大家看看图片效果,大 ...
- 在Kali上安装打印机
在Kali 2.0上安装打印机 最近在玩儿渗透测试,就把自己的办公电脑做成了Kali,可是发现办公室的网络打印机没办法正常使用,上网查了一下,把整个过程简单的记录一下,省的忘记了 1.安装cups a ...
- uninstall OpenJDK9
sudo apt--jre openjdk--jdk ///要慎用auto命令,会把所有的软件包删掉 https://www.linuxidc.com/Linux/2017-11/148941.htm ...
- Statspack的使用
Statspack是Oracle 8i以上提供的一个非常好的性能监控与诊断工具,基本上全部包含了BSTAT/ESTAT的功能,更多的信息可以参考附带文档$ORACLE_HOME/rdbms/admin ...
- USACO 2.2 Preface Numbering
Preface Numbering A certain book's prefaces are numbered in upper case Roman numerals. Traditional R ...
- QT-项目文件说明
前言:如题. 一.项目文件概述 文件 功能 helloworld.pro 包含了项目信息 helloworld.pro.user 用户信息 hellodialog.h 自定义类hellodialog的 ...
- 基础apache命令
在启动Apache服务之前,可以使用下面的命令来检查配置文件的正确性. C:\Apache2.2\bin> httpd -n Apache2.2 -t 还可以通过命令行控制Apache服务 ...
- Spark Streaming概念学习系列之SparkStreaming的高层抽象DStream
不多说,直接上干货! SparkStreaming的高层抽象DStream 为了便于理解,Spark Streaming提出了DStream抽象,代表连续不断的数据流. DStream 是一个持续的R ...
- [转]java多线程并发去调用一个类的静态方法安全性探讨
文章转自:https://blog.csdn.net/weibin_6388/article/details/50750035 这篇文章主要讲多线程对静态方法访问的数据安全性 总结如下: 1,java ...