Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When you are trying to fit models to a large dataset, the common advice is to partition the data into three parts: the training, validation, and test dataset.

This is because the models usually have three "levels" of parameters: the first "parameter" is the model class (e.g. SVM, neural network, random forest), the second set of parameters are the "regularization" parameters or "hyperparameters" (e.g. lasso penalty coefficient, choice of kernel, neural network structure) and the third set are what are usually considered the "parameters" (e.g. coefficients for the covariates.)

Given a model class and a choice of hyperparameters, one selects the parameters by choosing the parameters which minimize error on the training set. Given a model class, one tunes the hyperparameters by minimizing error on the validation set. One selects the model class by performance on the test set.

But why not more partitions? Often one can split the hyperparameters into two groups, and use a "validation 1" to fit the first and "validation 2" to fit the second. Or one could even treat the size of the training data/validation data split as a hyperparameter to be tuned.

Is this already a common practice in some applications? Is there any theoretical work on the optimal partitioning of data?

share|improve this question
up vote 44 down vote accepted

First, I think you're mistaken about what the three partitions do. You don't make any choices based on the test data. Your algorithms adjust their parameters based on the training data. You then run them on the validation data to compare your algorithms (and their trained parameters) and decide on a winner. You then run the winner on your test data to give you a forecast of how well it will do in the real world.

You don't validate on the training data because that would overfit your models. You don't stop at the validation step's winner's score because you've iteratively been adjusting things to get a winner in the validation step, and so you need an independent test (that you haven't specifically been adjusting towards) to give you an idea of how well you'll do outside of the current arena.

Second, I would think that one limiting factor here is how much data you have. Most of the time, we don't even want to split the data into fixed partitions at all, hence CV.

share|improve this answer
The conceptual issue I had is that if you are comparing enough models, you are effectively fitting on the validation data when you "decide on a winner" using the validation data. Hence still may be a point in partitioning the validation data. – charles.y.zheng Apr 12 '11 at 14:08
I think that the training-validation layer and the validation-testing layer serve different purposes in some sense, and that you do eventually have to compare models on a common validation set if you're going to declare a winner. So I'm not sure that additional layers help. (Though my knowledge isn't deep enough to really know.) The closest thing I can think of to your suggestion is how the Netflix competition was run. I believe they used partial test sets to keep teams from climbing the test set gradient, but I think it's different. – Wayne Apr 12 '11 at 21:36
No need to split the data into 3 parts, you only need 2. The 1st data set is used to fit your models. The 2nd data set is used to validate those fits on an independent data set. The "how well it will do in the real world" question is already answered in the 2nd data set... it wasn't used for fitting. Of course, if you want even better estimates then you'll want to randomly split your data into 2 sets many times, each time fitting your models to the training part and predicting on the validation part. – user10882 Apr 25 '12 at 21:18
I think the key question is: what exactly do you mean by "fit your models"? As the original poster pointed out, there are things which might be called coefficients which are fit on a training set as a direct result of processing the data, but there are also parameters (a threshold, for example) that can be set independently of the data itself. If you were willing to enter multiple copies of each model with different choices for parameters, you could do it in two steps. But if you intend to tweak these parameters, that seems to require an additional step. – Wayne Apr 25 '12 at 21:52
I don't understand. If you compare the models between the validation and training and then choose the best one, you are basically only training on one dataset and, hence, overfitting. – Goldname Jun 29 at 23:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.