kfold kfold(n_splits= random_state=seedwe need to provide the number of trees we are going to build here we are building trees with split points chosen from featuresnum_trees max_features nextbuild the model with the help of following scriptmodel randomforestclassifier(n_estimators=num_treesmax_features=max_featurescalculate and print the result as followsresults cross_val_score(modelxycv=kfoldprint(results mean()output the output above shows that we got around accuracy of our bagged random forest classifier model extra trees it is another extension of bagged decision tree ensemble method in this methodthe random trees are constructed from the samples of the training dataset in the following python recipewe are going to build extra tree ensemble model by using extratreesclassifier class of sklearn on pima indians diabetes dataset firstimport the required packages as followsfrom pandas import read_csv from sklearn model_selection import kfold from sklearn model_selection import cross_val_score from sklearn ensemble import extratreesclassifier nowwe need to load the pima diabetes dataset as did in previous examplespath " :\pima-indians-diabetes csvheadernames ['preg''plas''pres''skin''test''mass''pedi''age''class'data read_csv(pathnames=headernamesarray data values array[:, :