# Bagging Vs Boosting

## Bagging

• Bagging is used when objective is to reduce variance of a decision tree.
• Random Forest is an expansion over bagging. It also makes the random selection of features rather than using all features to develop trees.
• The following steps which are taken to implement a Random forest the concept is to create a few subsets of data from the training sample, which is chosen randomly with replacement.
• Consider X observations Y features in the training data set. First, a model from the training data set is taken randomly with substitution.
• Tree is developed to the largest.
• Given steps are repeated, and prediction is given, which is based on the collection of predictions from n number of trees.

## Advantages of using Random Forest

• It manages a higher dimension Data Set.
• It manages missing quantities.

## Disadvantages of using Random Forest

• The last prediction depends on the mean predictions from subset trees, it won't give precise value for the regression model.

## Boosting

• Boosting is another ensemble procedure to make a collection of predictors.
• Gradient Boosting is an expansion of the boosting procedure.`Gradient Boosting = Gradient Descent + Boosting`
• It utilizes a gradient descent algorithm that can optimize any differentiable loss function.

## Advantages of using Gradient Boosting

• Works well with interactions
• Supports different loss functions

## Disadvantages of using a Gradient Boosting

• Requires cautious tuning of different hyper-parameters.

## Difference between Bagging and Boosting

Bagging Boosting
Various training data subsets are randomly drawn with replacement
from the whole training dataset.
Each new subset contains the components that were misclassified by previous models.
Attempts to tackle the over-fitting issue. Tries to reduce bias.
If the classifier is unstable, then we need to apply bagging. If the classifier is steady and straightforward, then we need to apply boosting.
Every model receives an equal weight. Models are weighted by their performance.
Objective to decrease variance, not bias. Objective to decrease bias, not variance.
It is the easiest way of connecting predictions that belong to the same type. It is a way of connecting predictions that belong to the different types.
Every model is constructed independently. New models are affected by the performance of the previously developed model.
{"ft_lang_label":"__label__en","ft_lang_prob":0.9126065,"math_prob":0.8567956,"size":2410,"snap":"2021-21-2021-25","text_gpt3_token_len":477,"char_repetition_ratio":0.115544476,"word_repetition_ratio":0.026666667,"special_character_ratio":0.18755187,"punctuation_ratio":0.094527364,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.957863,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-06-18T23:42:38Z\",\"WARC-Record-ID\":\"<urn:uuid:b203810c-f022-4928-bb63-4cdc697ebe20>\",\"Content-Length\":\"60761\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8de40e34-223e-42fb-8dfd-10b5ba393bd8>\",\"WARC-Concurrent-To\":\"<urn:uuid:60f21a6c-9a39-449e-9744-b13fd577fe08>\",\"WARC-IP-Address\":\"104.21.82.82\",\"WARC-Target-URI\":\"https://www.wikitechy.com/tutorial/data-mining/bagging-vs-boosting\",\"WARC-Payload-Digest\":\"sha1:4463EP22UJWN3J4O36MMQMJDMB5SWE3C\",\"WARC-Block-Digest\":\"sha1:IUFKIVUJZH44VFEIAG5RC3Y5ERZYP7ES\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-25/CC-MAIN-2021-25_segments_1623487643354.47_warc_CC-MAIN-20210618230338-20210619020338-00456.warc.gz\"}"}