Skip to main content
. 2022 Sep 29;22(19):7409. doi: 10.3390/s22197409
Algorithm 1 The algorithm for bagging classifier
  • 1:

    for  b=1,P:  do

  • 2:

         Sample, with replacement, n training examples from T, L; call these Tb, Lb.

  • 3:

         Train a classification tree, fb on Tb, Lb.

  • 4:

         After training, predictions for unseen samples x

  • 5:

         obtain the final predictions from all the individual fb on x by taking the average of all predictions for regression or taking the majority vote for a classification problem using Equation (1).

  • 6:

    end for