# Boosting and bagging - Random forest classifier

**URL:** <https://forum.orfeo-toolbox.org/t/boosting-and-bagging-random-forest-classifier/1574>\
**Category:** OTB Development\
**Created:** [April 25, 2023, 3:28pm UTC](https://forum.orfeo-toolbox.org/t/boosting-and-bagging-random-forest-classifier/1574 "2023-04-25T15:28:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViGeo](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/vigeo/32/685_2.png) [@ViGeo](https://forum.orfeo-toolbox.org/u/ViGeo)\
**Post date:** [April 25, 2023, 3:28pm UTC](https://forum.orfeo-toolbox.org/t/boosting-and-bagging-random-forest-classifier/1574/1 "2023-04-25T15:28:35Z")

</div>

Hello, can you tell me which method of joint learning the random forest classifier of the OTB complement uses, boosting or bagging?

I did not find such information in the documentation.

---

<div class="post-metadata">

**Author:** ![thibaut.romain](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/ecc23a/32.png) [@thibaut.romain](https://forum.orfeo-toolbox.org/u/thibaut.romain)\
**Post date:** [April 26, 2023, 9:00am UTC](https://forum.orfeo-toolbox.org/t/boosting-and-bagging-random-forest-classifier/1574/2 "2023-04-26T09:00:26Z")

</div>

Hi @ViGeo

What RF classifier do you use ? `sharkrf` or `rf`, nevertheless i would say boosting by looking at the code but I have to verify with the classifier you are using (rf is using openCV, sharkrf is using Shark).  
By the way, In OTB you can explicitly call the boosting method using classifier.boost, which calls [opencv boosting method](https://docs.opencv.org/2.4/modules/ml/doc/boosting.html), the doc part in the cookbook is [here](https://www.orfeo-toolbox.org/CookBook/Applications/app_TrainImagesClassifier.html?highlight=boost#boost-classifier-options)

Best regards

---

<div class="post-metadata">

**Author:** ![ViGeo](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/vigeo/32/685_2.png) [@ViGeo](https://forum.orfeo-toolbox.org/u/ViGeo)\
**Post date:** [April 26, 2023, 10:24am UTC](https://forum.orfeo-toolbox.org/t/boosting-and-bagging-random-forest-classifier/1574/3 "2023-04-26T10:24:47Z")

</div>

Hello,  
I’m using Random forests classifier.

I ask so I can quote correctly in the article.

---

<div class="post-metadata">

**Author:** ![thibaut.romain](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/ecc23a/32.png) [@thibaut.romain](https://forum.orfeo-toolbox.org/u/thibaut.romain)\
**Post date:** [April 27, 2023, 9:29am UTC](https://forum.orfeo-toolbox.org/t/boosting-and-bagging-random-forest-classifier/1574/4 "2023-04-27T09:29:59Z")

</div>

Hello @ViGeo

I looked further in the code and asked a contributor who worked on that, he confirmed that the random forest in OTB uses the `bagging` method. This is why there is a Boosting classifier which specifically does the boosting method.

Best regards
