svc( = gamma= svc( = gamma= svc( = gamma= gamma= svc( = gamma= svc( = gamma= svc( = gamma= gamma= svc( = gamma= svc( = gamma= svc( = gamma= simple grid search we can implement simple grid search just as for loops over the two parameterstraining and evaluating classifier for each combinationin[ ]naive grid search implementation from sklearn svm import svc x_trainx_testy_trainy_test train_test_splitiris datairis targetrandom_state= print("size of training set{size of test set{}formatx_train shape[ ]x_test shape[ ])best_score for gamma in [ ]for in [ ]for each combination of parameterstrain an svc svm svc(gamma=gammac=csvm fit(x_trainy_trainevaluate the svc on the test set score svm score(x_testy_testif we got better scorestore the score and parameters if score best_scorebest_score score best_parameters {' ' 'gamma'gammaprint("best score{ }format(best_score)print("best parameters{}format(best_parameters)out[ ]size of training set size of test set best score best parameters{' ' 'gamma' the danger of overfitting the parameters and the validation set given this resultwe might be tempted to report that we found model that performs with accuracy on our dataset howeverthis claim could be overly optimistic (or just wrong)for the following reasonwe tried many different parameters and grid search