在做机器学习项目的时候,一开始我们会将数据集分为训练集和测试集,要记住测试集只能用一次,只能用来评估最终最好的模型。如果你反复去使用测试集,反复测试后从里面挑最好的,你就是在耍流氓。
建模过程中肯定有模型调整,必然涉及到模型挑选的问题,当过程中我需要做很多个模型时,问题来了,如果我不去评估我怎么知道哪一个模型是最好的?
Typically we can’t decide on which final model to use with the test set before first assessing model performance. There is a gap between our need to measure performance reliably and the data splits (training and testing) we have available.
想想在利用测试集之前,怎么也得加上一个评估过程,帮助我们确定,到底哪个模型才是最好的,才是值得最终被用到测试集上的。
这个过程就涉及到重复抽样了resampling!
Resampling methods, such as cross-validation and the bootstrap, are empirical simulation systems. They create a series of data sets similar to the training/testing split
首先理解过拟合
写重复抽样前我们先回顾过拟合的概念,数据划分后,我们会在训练集中训练好模型,怎么评估这个模型?很自然的我可以想到,就将模型用在训练集中,将真实值和预测值对比不就