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. Mac OS X中配置Apache后提示You don\’t have permission to access / on this server

    根据这篇博客http://www.cnblogs.com/snandy/archive/2012/11/13/ […]...

  2. 解决eclipse启动时出现“failed to load the jni shared library”

    如何解决启动eclipse出现failed to load the jni shared library的问题 […]...

  3. error 1044 (42000):access denied for user \’\’@\’localhost\’ to database \’mysql\’ 解决方法

    重新安装mariaDB数据库时,出现安装权限问题,中止安装发现居然能够登陆mysql,但是登陆时可以不填密码, […]...

  4. the application failed to initialize properly 0xc0000142

    在服务器上运行cms报the application failed to initialize properl […]...

  5. Convert all popular videos & audio to MP4, MP3

    This is a useful MP4 Converter to convert all popular v […]...

  6. 【转】64位win7环境eclipse集成svn后出现Failed to load JavaHL Library的解决办法

    出现错误“Failed to load JavaHL Library”的绝大多数情况是使用的Linux环境,在 […]...

  7. Mysql

    Mysql – 解决Access denied for user \’\’ […]...

  8. 语义分割的简单指南 A Simple Guide to Semantic Segmentation

    语义分割是将标签分配给图像中的每个像素的过程。这与分类形成鲜明对比,其中单个标签被分配给整个图片。语义分段将同 […]...

随机推荐

  1. Flex简易教程

    CSS 弹性盒子布局(Flex 布局)是 CSS 的模块之一,用来快速建立二维自适应布局。本文重点介绍该布局的 […]...

  2. 2016中国APP分类排行榜参选入围产品公示

    2016中国APP分类排行榜参选入围产品公示     由中国科学院《互联网周刊》、中国社会科学院信息化研究中心 […]...

  3. (数据科学学习手札82)基于geopandas的空间数据分析——geoplot篇(上)

    本文示例代码和数据已上传至我的Github仓库https://github.com/CNFeffery/Dat […]...

  4. 8086汇编 程序编译

    8086汇编 程序编译 源程序到执行可执行文件的过程 ↓ 源程序文件.asm -> 目标文件.obj - […]...

  5. 初学android小笔记(一)

    初学android小笔记(一) 一:应用外观基础设置 (1)去掉标题栏:打开Android Manifest文 […]...

  6. 三分钟小短文:一致性非锁定读与一致性锁定读

    台上三分钟,台下三小时 台上三分钟,台下三小时,兄弟们,今天咱们花三分钟了解下数据库中的两种读(select) […]...

  7. 6大数据实战系列-sparkSql实战

    sparkSql两个最重要的类SqlContext、DataFrame,DataFrame功能强大,能够与rd […]...

  8. 程序员必备的一些网站

    程序员必备的一些网站 1.GitHub(https://github.com/) GitHub是一个面向开源及 […]...

展开目录

目录导航