figure - model performance metrics for tuned svm model on the breast cancer dataset well things are certainly looking great nowour model gives an overall score and model accuracy of on the test dataset tooas depicted in figure - this should give you clear indication of the power of hyperparameter tuningthis scheme of things can be extended for different models and their respective hyperparameters we can also play around with the evaluation measure we want to optimize the scikit-learn framework provides us with different values that we can optimize some of them are adjusted_rand_scoreaverage_precisionf average_recalland so on andomized search grid search is very popular method to optimizing hyperparameters in practice it is due to its simplicity and the fact that it is embarrassingly parallelizable this becomes important when the dataset we are dealing with is of large size but it suffers from some major shortcomingsthe most important one being the limitation of manually specifying the grid this brings human element into process that could benefit from purely automatic mechanism randomized parameter search is modification to the traditional grid search it takes input for grid elements as in normal grid search but it can also take distributions as input for example consider the parameter gamma whose values we supplied explicitly in the last section instead we can supply distribution from which to sample gamma the efficacy of randomized parameter search is based on the proven (empirically and mathematicallyresult that the hyperparameter optimization functions normally have low dimensionality and the effect of certain parameters are more than others we control the number of times we want to do the random parameter sampling by specifying the number of iterations we want to run (n_iternormally higher number of iterations mean more granular parameter search but higher computation time to illustrate the use of randomized parameter searchwe will use the example we used earlier but replace the gamma and values with distribution the results in our example may not be very different from the grid searchbut we establish the process that can be followed for future reference import scipy from sklearn model_selection import randomizedsearchcv param_grid {' 'scipy stats expon(scale= )'gamma'scipy stats expon(scale )'kernel'['rbf''linear']random_search randomizedsearchcv(svc(random_state= )param_distributions=param_gridn_iter= cv= random_search fit(x_trainy_trainprint("best parameters set found on development set:"random_search best_params_ best parameters set found on development setout[ ]{' ' 'gamma' 'kernel''linear'