using pipeline in grid search works the same way as using any other estimator we define parameter grid to search overand construct gridsearchcv from the pipeline and the parameter grid when specifying the parameter gridthere is slight changethough we need to specify for each parameter which step of the pipeline it belongs to both parameters that we want to adjustc and gammaare parameters of svcthe second step we gave this step the name "svmthe syntax to define parameter grid for pipeline is to specify for each parameter the step namefollowed by __ ( double underscore)followed by the parameter name to search over the parameter of svc we therefore have to use "svm__cas the key in the parameter grid dictionaryand similarly for gammain[ ]param_grid {'svm__c'[ ]'svm__gamma'[ ]with this parameter grid we can use gridsearchcv as usualin[ ]grid gridsearchcv(pipeparam_grid=param_gridcv= grid fit(x_trainy_trainprint("best cross-validation accuracy{ }format(grid best_score_)print("test set score{ }format(grid score(x_testy_test))print("best parameters{}format(grid best_params_)out[ ]best cross-validation accuracy test set score best parameters{'svm__c' 'svm__gamma' in contrast to the grid search we did beforenow for each split in the cross-validationthe minmaxscaler is refit with only the training splits and no information is leaked from the test split into the parameter search compare this (figure - with figure - earlier in this in[ ]mglearn plots plot_proper_processing(using pipelines in grid searches