the preceding figure illustrates this process for five blocksthe dataset is split into five pieces then for each foldyou hold out one of the blocks for testing and train on the other four you can use any number of folds you wish five or ten fold is typicalit corresponds to training with or percent of your data and should already be close to what you would get from using all the data in an extreme caseif you have as many folds as datapointsyou can simply perform leave-one-out cross-validation when generating the foldsyou need to be careful to keep them balanced for exampleif all of the examples in one fold come from the same classthe results will not be representative we will not go into the details of how to do this because the machine learning packages will handle it for you we have now generated several models instead of just one sowhat final model do we return and use for the new datathe simplest solution is now to use single overall model on all your training data the cross-validation loop gives you an estimate of how well this model should generalize cross-validation schedule allows you to use all your data to estimate if your methods are doing well at the end of the cross-validation loopyou can use all your data to train final model although it was not properly recognized when machine learning was starting outnowadays it is seen as very bad sign to even discuss the training error of classification system this is because the results can be very misleading we always want to measure and compare either the error on held-out dataset or the error estimated using cross-validation schedule building more complex classifiers in the previous sectionwe used very simple modela threshold on one of the dimensions throughout this bookyou will see many other types of modelsand we're not even going to cover everything that is out there what makes up classification modelwe can break it up into three partsthe structure of the modelin thiswe use threshold on single feature the search procedurein thiswe try every possible combination of feature and threshold the loss functionusing the loss functionwe decide which of the possibilities is less bad (because we can rarely talk about the perfect solutionwe can use the training error or just define this point the other way around and say that we want the best accuracy traditionallypeople want the loss function to be minimum