in[ ]x_trainx_testy_trainy_test train_test_splitcancer datacancer targetrandom_state= grid gridsearchcv(pipeparam_gridcv= grid fit(x_trainy_trainprint("best params:\ {}\nformat(grid best_params_)print("best cross-validation score{ }format(grid best_score_)print("test-set score{ }format(grid score(x_testy_test))out[ ]best params{'classifier'svc( = cache_size= class_weight=nonecoef = decision_function_shape=nonedegree= gamma= kernel='rbf'max_iter=- probability=falserandom_state=noneshrinking=truetol= verbose=false)'preprocessing'standardscaler(copy=truewith_mean=truewith_std=true)'classifier__c' 'classifier__gamma' best cross-validation score test-set score the outcome of the grid search is that svc with standardscaler preprocessingc= and gamma= gave the best result summary and outlook in this we introduced the pipeline classa general-purpose tool to chain together multiple processing steps in machine learning workflow real-world applications of machine learning rarely involve an isolated use of modeland instead are sequence of processing steps using pipelines allows us to encapsulate multiple steps into single python object that adheres to the familiar scikit-learn interface of fitpredictand transform in particular when doing model evaluation using crossvalidation and parameter selection using grid searchusing the pipeline class to capture all the processing steps is essential for proper evaluation the pipeline class also allows writing more succinct codeand reduces the likelihood of mistakes that can happen when building processing chains without the pipeline class (like forgetting to apply all transformers on the test setor not applying them in the right orderchoosing the right combination of feature extractionpreprocessingand models is somewhat of an artand often requires some trial and error howeverusing pipelinesthis "trying outof many different processing steps is quite simple when algorithm chains and pipelines