查看: 13117| 回复: 26
跳转到指定楼层
上一主题 下一主题
收起左侧

一个关于cross-validation的问题,求助~~~

全局:
1小米
对Introduction to statistical learning 这本书第6章lab部分对ridge regression,  lasso, 和 Principal Components Regression的比较有个疑问,书里介绍的步骤如下:
1. 把整个dataset分成了training和test两部分
2. 用training部分做cross-validation来为ridge regression选取合适的lambda, 然后用test data 得到 test MSE
3. 用training部分做cross-validation来为lasso选取合适的lambda, 然后用test data 得到 test MSE.1point3acres
4. 用training部分做cross-validation来为PCR选取合适的变量个数, 然后用test data 得到 test MSE
5. 比较 2,3,4中 Ridge regression, lasso, PCR各自的test MSE

不明白为什么要先用cross-validation来选择tuning parameter,然后用 Validation Set Approach 的方法比较各个model的test MSE。为什么不能直接对整个数据做cross-validation,得到ridge regression, lasso, PCR各自的最小的test MSE直接进行比较呢?


最佳答案

查看完整内容

哈哈,我之前也困惑过有了CV到底还需不需要holdout,最后还是在书上找到了答案,就是depend on how many data you have 至于为什么会低估,其实我也不是很确定,所以理由还是和之前的一样。然后你想想,CV的目的就在于Tune Parameter to have the best model of that technique, 比如randomforest,选择最好的n (# of trees)和m (# of initial features),在这其中CV 的MSE就起作用了,这里CV MSE的作用是自己跟自己比,RF1 ...

上一篇:关于sub考试
下一篇:Things to know about NYU data science
🔗
mlq90103 2014-7-1 01:58:19 | 只看该作者
全局:
地有多大产 发表于 2014-7-1 11:11
感激, 貌似只有你理解了我的意思。。。data scientist对表达能力要求那么高,开始怀疑我到底适不适合。 ...

哈哈,我之前也困惑过有了CV到底还需不需要holdout,最后还是在书上找到了答案,就是depend on how many data you have

至于为什么会低估,其实我也不是很确定,所以理由还是和之前的一样。然后你想想,CV的目的就在于Tune Parameter to have the best model of that technique, 比如randomforest,选择最好的n (# of trees)和m (# of initial features),在这其中CV 的MSE就起作用了,这里CV MSE的作用是自己跟自己比,RF1 和 RF2 比,ANN1 和 ANN2 比。

但是,当我们要选择到底是RF好还是ANN好的时候,我们希望有个新的dataset,从来没有用在 training 里面,然后分别用最好的RF + 最好的ANN + 最好的其他 在这个 holdout上evaluate,然后选出the best one,这里就是test MSE。我们最终希望score MSE最小(就是apply到未来的数据后的MSE)。而在这个过程中, test MSE更接近于score MSE的地位,而不是CV MSE。 ..

当然如果数据不够,CV MSE也可以用,大概就是这样

还有,CV的作用应该是tune parameter,而不是将他们combine在一起作为model。CV的感觉有点像ensemble,但是ensemble如bagging,boosting,multilearner,etc等在resampling的过程中更全面一点,所以lower bias + variance要用ensemble而不仅是CV,至于你说的holdout方法我不确定是什么
.google  и
回复

使用道具 举报

🔗
parachutemd 2014-7-1 03:02:42 | 只看该作者
全局:
then you are training and testing on the same dataset.
回复

使用道具 举报

🔗
xingzhui222 2014-7-1 03:28:02 | 只看该作者
全局:
为什么不能直接对整个数据做cross-validation,得到ridge regression, lasso, PCR各自的最小的test MSE直接进行比较呢?

cross validation and test set should be totally separated. That said, test set is assumed to be unknown to modeller. If you do cross validation on training set and test set, you are using the test set to tune the parameter. Then when you try to apply your model (tuned from your training set and test set), you will get a "better" test MSE. But in fact,  the 'true' MSE is anticipated to be higher. Namely, your model performance will be too good to be true.
回复

使用道具 举报

🔗
 楼主| 地有多大产 2014-7-1 03:30:02 | 只看该作者
全局:
parachutemd 发表于 2014-7-1 03:02
then you are training and testing on the same dataset.

为什么最后要用validation set approach计算test MSE而不是用cross-validation计算呢?不是说好用cross-validation比用validation set approach估计test MSE更好的吗?
cross-validation里面并没有涉及你说的 “training and testing on the same dataset” 的问题啊. ----
回复

使用道具 举报

🔗
 楼主| 地有多大产 2014-7-1 03:42:34 | 只看该作者
全局:
xingzhui222 发表于 2014-7-1 03:28
cross validation and test set should be totally separated. That said, test set is assumed to be un ...

In fact, I just used the training data to tune the parameter. For example, there are 10 folders in total , then I just use 9 of the folders to tune the parameter and use the one left to estimate test MSE, and then I repeat it for 10 times. Although I average the 10 test MSEs finally, it doesn't mean I used both the training and test data for tuning.
回复

使用道具 举报

🔗
 楼主| 地有多大产 2014-7-1 03:46:13 | 只看该作者
全局:
xingzhui222 发表于 2014-7-1 03:28 ..
cross validation and test set should be totally separated. That said, test set is assumed to be un ...

I understand what you said is reasonable if we want to calculate the test MSE using validation set approach in the last step. However, since we have already got the test MSE when tuning the parameters, why don't we use the test MSE we have already got directly?
回复

使用道具 举报

🔗
parachutemd 2014-7-1 05:08:06 | 只看该作者
全局:
地有多大产 发表于 2014-7-1 03:30. 1point 3 acres
为什么最后要用validation set approach计算test MSE而不是用cross-validation计算呢?不是说好用cross-v ...

I consider cross validation as part of training because you are still tuning your parameter to get the best model, this data will not serve as an independent result to justify your choice
回复

使用道具 举报

🔗
mlq90103 2014-7-1 05:31:28 | 只看该作者
全局:
一般来说,两个都没错,但是如果数据量足够大的时候,一般留一个holdout,training时别碰,最后得到model了在holdout上测试。
如果直接用CV,毕竟holdout的信息不在当前的model,但包含在了别的model里。一般数据量很小的时候可以这么干,极端的例子就是leave-one-out CV。
一般数据足够大的话,还是有一个holdout比较好
回复

使用道具 举报

🔗
 楼主| 地有多大产 2014-7-1 05:52:33 | 只看该作者

RE: 一个关于cross-validation的问题,求助~~~

全局:
mlq90103 发表于 2014-7-1 05:31
一般来说,两个都没错,但是如果数据量足够大的时候,一般留一个holdout,training时别碰,最后得到model了 ...
. 1point 3 acres
"毕竟holdout的信息不在当前的model,但包含在了别的model里"

我对这句话不太理解,虽然holdout包含在了别的model里,但是别的model又有其他的holdout,并没有把这个holdout当做test data啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表