Sequentially Bootstrapped Ensembles¶
In the sampling section we have shown that sampling should be done by Sequential Bootstrapping.
The SequentiallyBootstrappedBaggingClassifier and SequentiallyBootstrappedBaggingRegressor extend sklearn’s Bagging Classifier/Regressor by using Sequential Bootstrapping instead of random sampling.
In order to build the indicator matrix we need the Triple Barrier Events (samples_info_sets) and price bars used to label the training data set. That is why samples_info_sets and price bars are input parameters for the classifier/regressor.
To better understand the underlying method, you may be interested in reading the Sequential Bootstrapping page of MlFinLab documentation.
Note
Underlying Literature
The following sources describe this method in more detail:
Advances in Financial Machine Learning, Chapter 4 by Marcos Lopez de Prado.
Implementation¶
Warning
This model is computationally expensive and may take some time to run.
The model from the MlFinlab package before version 1.4.0 was already orders of magnitude faster than the original, described in Advances in Financial Machine Learning.
We’ve further improved the model, starting from MlFinLab version 1.5.0 the execution is up to 200 times quicker compared to the models from version 1.4.0 and earlier. (The speed improvement depends on the size of the input dataset)
Research Notebook¶
The following research notebooks can be used to better understand Ensemble Methods.