then we will define the model we want to use and the parameter space for one of the model' hyperparameters here we will search the parameter alpha of the lasso model this parameter basically controls the strictness our regularization in [ ]lasso lasso(random_state= alphas np logspace(- - then we will initialize an estimator that will identify the model to be used here we notice that the process is identical for both learning single model and grid search of modelsi they both are objects of the estimator class in [ ]estimator gridsearchcv(lassodict(alpha=alphas)in [ ]estimator fit(x_trainy_trainout[ ]gridsearchcv(cv=noneerror_score='raise'estimator=lasso(alpha= copy_x=truefit_intercept=truemax_iter= normalize=falsepositive=falseprecompute=falserandom_state= selection='cyclic'tol= warm_start=false)fit_params={}iid=truen_jobs= param_grid={'alpha'array( - - - - - - - ])}pre_dispatch=' *n_jobs'refit=truereturn_train_score=truescoring=noneverbose= this will take our train set and learn group of lasso models by varying the value of the alpha hyperparameter the gridsearchcv object will also score the models that we are learning and we can us the best_estimator_ attribute to identify the model and the optimal value of the hyperparameter that gave us the best score also we can directly use the same object for predicting with the best model on unknown data in [ ]estimator best_score_ out[ ] in [ ]estimator best_estimator_ out[ ]lasso(alpha= copy_x=truefit_intercept=truemax_iter= normalize=falsepositive=falseprecompute=falserandom_state= selection='cyclic'tol= warm_start=falsein [ ]estimator predict(x_testout[ ]array( ]the next steps involve reiterating the whole process making changes to the data transformationmachine learning algorithmtuning hyperparameters of the algorithm etc but the basic steps will remain the same we will go into the elaborate details of these processes in future of the book here we will conclude our introduction to the scikit-learn framework and encourage you to check out their extensive documentation at stable version of scikit-learn