in scikit-learngrid search can be done using the gridsearchcv class we go through an example by performing grid search on support vector machine (svmmodel on the breast cancer dataset from earlier the svm model is another example of supervised machine learning algorithm that can be used for classification it is an example of maximum margin classifierwhere it tries to learn representation of all the data points such that separate categories\labels are divided or separated by clear gapwhich is as large as possible we won' be going into further extensive details here since the intent is to run grid searchbut we recommend you to check out some standard literation on svms if you are interested let' first split our breast cancer dataset variables and into train and test datasets and build an svm model with default parameters then we'll evaluate its performance on the test dataset by leveraging our model_evaluation_utils module from sklearn model_selection import train_test_split from sklearn svm import svc prepare datasets x_trainx_testy_trainy_test train_test_split(xytest_size= random_state= build default svm model def_svc svc(random_state= def_svc fit(x_trainy_trainpredict and evaluate performance def_y_pred def_svc predict(x_testprint('default model stats:'meu display_model_performance_metrics(true_labels=y_testpredicted_labels=def_y_predclasses=[ , ]figure - model performance metrics for default svm model on the breast cancer dataset would you look at thatour model gives an overall score of only and model accuracy of as depicted in figure - also by looking at the confusion matrixyou can clearly see that it is predicting every data point as benign (label basically our model learned nothinglet' try tuning this model to see if we get something better since we have chosen svm modelwe specify some hyperparameters specific to itwhich includes the parameter (deals with the margin parameter in svm)the kernel function (used for transforming data into higher dimensional feature spaceand gamma (determines the influence single training data point hasthere are lot of other hyperparameters to tunewhich you can check out at we build grid by supplying some pre-set values the next choice is selecting the score or metric we want to maximize here we have chosen to maximize accuracy of the model once that is donewe will be using five-fold cross-validation to build multiple models over this grid and evaluate them to get the best model detailed code and outputs are depicted as follows from sklearn model_selection import gridsearchcv setting the parameter grid