2
$\begingroup$

I don't understand why using the test set for model evaluation is a bad idea.

I completely understand why you should not use your test set to train your model (because in that case, you would be memorizing and you just cannot tell whether your model will generalize well or not if you don't have a separate test set). But why is it that simply using your test set to test (not train) your model is bad? You won't be changing any parameters of the model (because you are not training).

For instance, at the end of this video, Luis says we are breaking what he calls the "Golden rule" (i.e. never use your testing data for training). However, all I can see he is doing is using the test set to verify which model performs better to then be able to make a selection on which model he will use in the end.

$\endgroup$
1
  • 1
    $\begingroup$ Usually you train the model and every N iterations (e.g. 1000) test it on a separate validation set. Validation set error is often used to stop the training. Test set is used only once after you are done training, e.g. to compare the efficiency of different algorithms. $\endgroup$
    – Alex
    Commented Sep 25, 2017 at 23:38

2 Answers 2

2
$\begingroup$

Choosing a variation of your model is a form of training. Just because you are not using gradient descent or whatever training process is core to a model class, does not mean your parameters are not influenced by this selection process. If you generated many thousands of models with random parameters and picked the best performing one on a data set, then this is also form of training. In fact, this is a valid way of optimising, called Random Search - it is somewhat inefficient for large models, but it still works.

You may generate hundreds of models using the training data and using gradient descent or boosting (depending on what the training algorithm uses in your model), then select the one that performs best on cross-validation. In that case, then as well as the selection process that you intend to use this for, you are also effectively using the cv data set to fine-tune the training from the first step, using something quite similar to random search.

The main benefit of having two stages to testing (cv and test sets), is that you will get an unbiased estimate of model performance from the test set. This is considered important enough that it has become standard practice.

$\endgroup$
2
$\begingroup$

In the linked video, a polynomial is fitted to some data. The degree of the polynomial has to be chosen, but it cannot be trained. It is therefore a hyperparameter. In order to choose the degree, several instances of the algorithm, each one trained with a polynomial of different degree, have to be evaluated on a data set that was not used for training. However, if we used the test set for assessing the values of hyperparameters, we would also be coupling the resulting model to the data in the test set, as the chosen hyperparameter (and therefore the whole model) would depend on the test set data.

The test set should only be used for the final evaluation in order to know how your algorithm is going to behave on data that has never been seen before by it. This is why there is normally a validation set used to tune the hyperparameters.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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