in theorywe can extend the same principles for tuning our algorithm we can evaluate the performance of particular values of the model hyperparameters on the test set retrain the model with different partition of training and test set with different values of hyperparameters if the new parameters perform better than the old ones we take them and keep repeating the same process until we have the optimal values of the hyperparameters this scheme of things is simple but it suffers from serious flaw it induces bias in the model development process although the test set is changed in every iterationthe data is being seen by the model to make some choices about the model development process (as we tune and build the modelhencethe models that we develop end up being biased and not well-generalized and their performance may or may not reflect their performance on unseen data simple change in the data splitting process can help us avoid this leakage of unseen data suppose we initially made three different subsets of data instead of the original two one is the usual training setthe second one is the test set and the last one is called validation set so we can train our models on the train data evaluate their performance on the validation data to tune model parameters (or even to select among different modelsonce we are done with the tuning processwe can evaluate the final model on the really unseen test set and report the performance on the test set as the approximate performance of the model on the real-world unseen data in the very essence of things this is the basic principle behind the process of cross validationas depicted in figure - figure - building toward the cross-validation process for model building and tuning figure - gives us an idea of how the whole process works we divide the original dataset into train and test set the test set is completely set aside from the learning process the train set so obtained is again split into an actual train set and validation set then we learn different models on the train set point worth noting here is that the models are generali all of them can be of single type for example logistic regression but with different hyperparameters they can also be models using other algorithms like tree based methodssupport vector machinesand so on the process of model selection is similar irrespective of whether we are assessing completely different models or whether we are trying out different hyperparameter values of the same type of models once we have the models developedwe assess their performance on the validation set and select the model with the best performance as the final model we leverage model evaluation metrics for this based on the type of model (accuracyf scorermsesilhouette coefficientand so on