supervised machine learning plt plot(range(steps+ )learner errorsnext(markers)label= "min_child_weight={mcw}gamma={gamma}"plt legend(plt draw( plot_boosting_trees(datagradient tree boosting the following implements gradient boosted trees for classification if you want to use this gradient tree boosting for real problemwe recommend using xgboost [chen and guestrin gtb_learner subclasses dt-learner the method learn_tree is used unchanged dt-learner assumes that the value at the leaf is the prediction of the leafthus leaf_value needs to be overridden it also assumes that all nodes at leaf have the same predictionbut in gbt the elements of leaf can have different valuesdepending on the previous trees thus sum_losses also needs to be overridden learnboosting py -(continued class gtb_learner(dt_learner)def __init__(selfdatasetnumber_treeslambda_reg= gamma= **dtargs)dt_learner __init__(selfdatasetsplit_to_optimize=evaluate log_loss**dtargsself number_trees number_trees self lambda_reg lambda_reg self gamma gamma self trees [ def learn(self)for in range(self number_trees)tree self learn_tree(self dataset conditions(self max_num_cuts)self trainself trees append(treeself display( , """iteration {itreesize {tree num_leavestrain logloss=self dataset evaluate_dataset(self dataset trainself gtb_predictorevaluate log_losstest logloss=self dataset evaluate_dataset(self dataset testself gtb_predictorevaluate log_loss)}"""return self gtb_predictor def gtb_predictor(selfexampleextra= )"""prediction for exampleextras is an extra contribution for this example being considered ""version june