I have some ambiguity about dividing training dataset in Bagging tree.
In fact I have found in this article About Decision Tree Ensembles- Bagging
That : the idea is to create several subsets of data from training sample chosen randomly with replacement.
I want to understand which of the next solutions is bagging technique: if the total dataset is D (Without the target value y)
Solution 1:
Splitting D to X_train and X_test :
Splitting X_train to sevral subtraining sets like : X_train1, X_train2, X_train3, X_train4 etc. where X_train1 + X_train2 +X_train3+X_train4 +....=X_train.
Finally training each dataset separatly and generating different model for each trained dataset.
Average of all the predictions (generated trees) is used to get the unique final output tree
OR
Solution 2:
- Splitting D to X_train1 and X_test1 :
- Training the dataset and generating the first decision tree
- Splitting D to X_train2 and X_test2
- Training the dataset and generating the second decision tree
- etc.
- Average of all the predictions (generated trees) is used to get the unique final output tree