# Gradient Boosting

One of the most appreciated is the Gradient Boosting Machine. The gradient boosting algorithm or GBM can be explained in relation to the AdaBoost Algorithm.

Boosting is explained as a manner of converting weak learners into strong learners.

**Related Course:**

Deep Learning for Computer Vision with Tensor Flow and Keras

## AdaBoost vs Gradient Boosting

The AdaBoost Algorithm starts with training a decision tree for which each observation has an equal weight. After the first tree is analysed and evaluated, we boost the weights of those observations that are hard to classify and diminish the weights for those that are simple to classify.

The second tree is established on this weighted data. The core idea is to boost upon the predictions of the first tree.

Gradient Boosting simply teaches various models in a gradual and sequential way. The core difference between AdaBoost and Gradient Boosting Algorithm lays in the manner in which the two algorithms signal the shortcomings of decision trees.

AdaBoost uses high weight data point, while Gradient boosting employs gradients in the loss function. The loss function is usually encountered in this type of machine learning and refers to the fact that it identifies how suitable are the coefficients of a model that fits certain data.

So, if you want to train a GBM Model in R you will have to make use of a GBM library. The first step is to mention the formula, which will include your response and predictor variables. Keep in mind that if no data is specified, the GBM will try to guess. Finally, you will mention the data and the n.trees argument, which will lead to the GBM model to assume 100 trees, a proper estimation of the GBM`s performance.

The GBM Model will signal you how many trees or iterations were used in the execution you have started. Also, depending on the variable importance, the GBM will underline whether or not any of the predictor variables featured zero influence in the pattern.

In the end, the predict.gbm() function will permit the generation of the predictions outside the data. For this part, you will have to specify the number of trees due to the fact that prediction won`t work otherwise.

Bottom line, the purpose of any kind of exercise in machine learning is to evaluate the predictions and gauge the model`s performance.

A gradient boosting algorithm involves three main elements: a loss function to be optimised, a weak learner to make predictions and an additive model in order for weak learners to minimize the loss function. This is a helpful algorithm that can overfit a training data set quickly.