from sklearn ensemble import gradientboostingclassifier 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[:, : array[:, nextgive the input for -fold cross validation as followsseed 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 nextbuild the model with the help of following scriptmodel gradientboostingclassifier(n_estimators=num_treesrandom_state=seedcalculate 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 gradient boosting classifier ensemble model voting ensemble algorithms as discussedvoting first creates two or more standalone models from training dataset and then voting classifier will wrap the model along with taking the average of the predictions of sub-model whenever needed new data in the following python recipewe are going to build voting ensemble model for classification by using votingclassifier class of sklearn on pima indians diabetes dataset we are combining the predictions of logistic regressiondecision tree classifier and svm together for classification problem as follows