ested in measuring how well our model generalizes to newpreviously unseen data we are not interested in how well our model fit the training setbut rather in how well it can make predictions for data that was not observed during training in this we will expand on two aspects of this evaluation we will first introduce cross-validationa more robust way to assess generalization performanceand discuss methods to evaluate classification and regression performance that go beyond the default measures of accuracy and provided by the score method we will also discuss grid searchan effective method for adjusting the parameters in supervised models for the best generalization performance cross-validation cross-validation is statistical method of evaluating generalization performance that is more stable and thorough than using split into training and test set in crossvalidationthe data is instead split repeatedly and multiple models are trained the most commonly used version of cross-validation is -fold cross-validationwhere is user-specified numberusually or when performing five-fold cross-validationthe data is first partitioned into five parts of (approximatelyequal sizecalled folds nexta sequence of models is trained the first model is trained using the first fold as the test setand the remaining folds ( - are used as the training set the model is built using the data in folds - and then the accuracy is evaluated on fold then another model is builtthis time using fold as the test set and the data in folds and as the training set this process is repeated using folds and as test sets for each of these five splits of the data into training and test setswe compute the accuracy in the endwe have collected five accuracy values the process is illustrated in figure - in[ ]mglearn plots plot_cross_validation(figure - data splitting in five-fold cross-validation usuallythe first fifth of the data is the first foldthe second fifth of the data is the second foldand so on model evaluation and improvement