scikit-learn:3.5. Validation curves: plotting scores to evaluate models

liguangsunls 2021-08-30 原文


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。


上面几幅图的产生程序參考:

发表于
2017-05-30 12:51 
liguangsunls 
阅读(148
评论(0
编辑 
收藏 
举报

 

版权声明:本文为liguangsunls原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/liguangsunls/p/6920195.html

scikit-learn:3.5. Validation curves: plotting scores to evaluate models的更多相关文章

  1. 1130

    是因为缺少访问权限,在MySQL -》User表里 执行 INSERT INTO `user` VALUES […]...

  2. rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

    今天在同步数据的时候提示rsync: failed to set times on “xxxx”: Opera […]...

  3. 2019 To do List

    做好测试不是靠编程,而是靠的是严禁的作风,慎密的逻辑思维,适合的测试流程。 内心有些迷茫的时候,迷茫的是作为测 […]...

  4. SpringBoot Validation参数校验 详解自定义注解规则和分组校验

    前言 Hibernate Validator 是 Bean Validation 的参考实现 。Hiberna […]...

  5. 【C# TO JAVA】 Win10 to Osx10 开发环境统一快捷键方案

    Win10 to OSX10 VS19 to IntelliJ20   在使用几天新快捷键后又找到了统一方案 […]...

  6. php装上sqlserver驱动后仍然显示Call to undefined function sqlsrv_connect()问题

      今天老师要求本来的php+mysql改为php+sqlserver,在网上搜索了相应的教程,说是“需要下载 […]...

  7. The POP3 service failed to start because

    After instslling AD on my new DC I now find POP3 not wo […]...

  8. Converter to MP4 for Mac(MP4格式转换器)

    Converter to MP4中文名字敏捷转换器,是macOS上一款非常不错的MP4格式转换器,敏捷转换器支 […]...

随机推荐

  1. 牛客网-C++

    2017/8/18 程序运行结束时才释放;静态变量在内存的静态存储区,静态数据一直占有着该存储单元直到程序结束 […]...

  2. 时间管理

    时间管理 pdf版本 一. 做一个有时间观念的人 守时 准时 1.1 守时 不迟到 不掐点到–掐点 […]...

  3. Linux(Centos7)下redis5集群搭建和使用

      1、简要说明   2018年十月 Redis 发布了稳定版本的 5.0 版本,推出了各种新特性,其中一点是 […]...

  4. 最牛逼的开源机器学习框架,你知道几个

    最牛逼的开源机器学习框架,你知道几个   机器学习毫无疑问是当今最热的话题,它已经渗透到生活的方方面面,在移动 […]...

  5. SSD固态硬盘内部结构详解 – 海之心1213

    SSD固态硬盘内部结构详解 对于一些关注SSD的朋友来说,可能都知道固态硬盘的速度是普通机械硬盘的好几倍,可以 […]...

  6. 密码工具,密码保存工具 — KeePass Password Safe

    https://keepass.info/ https://keepass.info/download.htm […]...

  7. 跨域问题

    跨域是指跨域名的访问,以下情况都属于跨域。   跨域原因说明 示例 域名不同 www.jd.com 与 www […]...

  8. 一步一步理解 python web 框架,才不会从入门到放弃 — 开始使用 Django

    背景知识 要使用 Django,首先必须先安装 Django。 下图是 Django 官网的版本支持,我们可以 […]...

展开目录

目录导航