# What is devising validating and testing of algorithms

Our algorithm tries to tune itself to the quirks of the training data sets.

In this phase we usually create multiple algorithms in order to compare their performances during the Cross-Validation Phase.

The concept of 'Training/Cross-Validation/Test' Data Sets is as simple as this.

Cross-Validation set (20% of the original data set): This data set is used to compare the performances of the prediction algorithms that were created based on the training set.

We choose the algorithm that has the best performance.

Notes: -It's very important to keep in mind that skipping the test phase is not recommended, because the algorithm that performed well during the cross-validation phase doesn't really mean that it's truly the best one, because the algorithms are compared based on the cross-validation set and its quirks and noises...

-During the Test Phase, the purpose is to see how our final model is going to deal in the wild, so in case its performance is very poor we should repeat the whole process starting from the Training Phase. Step 1) Training: Each type of algorithm has its own parameter options (the number of layers in a Neural Network, the number of trees in a Random Forest, etc). Most people pick the algorithm that performs best on the validation set (and that's ok).

The training set is used to fit the models; the validation set is used to estimate prediction error for model selection; the test set is used for assessment of the generalization error of the final chosen model. The validation set is often used to tune hyper-parameters. Training set: a set of examples used for learning: to fit the parameters of the classifier In the MLP case, we would use the training set to find the “optimal” weights with the back-prop rule Validation set: a set of examples used to tune the parameters of a classifier In the MLP case, we would use the validation set to find the “optimal” number of hidden units or determine a stopping point for the back-propagation algorithm Test set: a set of examples used only to assess the performance of a fully-trained classifier In the MLP case, we would use the test to estimate the error rate after we have chosen the final model (MLP size and actual weights) After assessing the final model on the test set, YOU MUST NOT tune the model any further! The error rate estimate of the final model on validation data will be biased (smaller than the true error rate) since the validation set is used to select the final model After assessing the final model on the test set, YOU MUST NOT tune the model any further!

Ideally, the test set should be kept in a “vault,” and be brought out only at the end of the data analysis. In case if you don't need to choose an appropriate model from several rivaling approaches, you can just re-partition your set that you basically have only training set and test set, without performing the validation of your trained model. For example, in the deep learning community, tuning the network layer size, hidden unit number, regularization term(wether L1 or L2) depends on the validation set What is the correct way to split the sets? @stmax Not to be pedantic, but once we have our final test error and we are NOT satisfied with the result, what do we do, if we cant tune our model any further? I have often wondered about this [email protected] you can continue tuning the model, but you'll have to collect a new test set.

So I need to set aside the test set in the beginning to avoid contamination of data. For each of your algorithms, you must pick one option. Step 2) Validating: You now have a collection of algorithms. But, if you do not measure your top-performing algorithm’s error rate on the test set, and just go with its error rate on the validation set, then you have blindly mistaken the “best possible scenario” for the “most likely scenario.” That's a recipe for disaster.

Then from the remaining data I can run cross-validation multiple times, each time selecting training set and cross-validation set randomly. At each step that you are asked to make a decision (i.e. Step 3) Testing: I suppose that if your algorithms did not have any parameters then you would not need a third step.

Test set (20% of the original data set): Now we have chosen our preferred prediction algorithm but we don't know yet how it's going to perform on completely unseen real-world data.

So, we apply our chosen prediction algorithm on our test set in order to see how it's going to perform so we can have an idea about our algorithm's performance on unseen data.

No, unless the dataset is huge or the signal:noise ratio is high.