First off: THIS IS AN EDITED (albeit rather heavily) VERSION OF: Simple Machine Learning Example Mk II By: Gus Gordon
I decided that this needed own post since the algorithm doesn't really resemble the original anymore in terms of its methodology.
The main point of this post is to outline something I haven't seen anyone else outline:
If you want repeatable, consistent, results, you MUST use:
context.model.n_estimators = 100 #or more, anything past 250 will drastically slow down the backtest and wont be too beneficial
Attached is an algorithm that implements n_estimators and only trades SPXL and XIV.
For further increases in accuracy and consistency:
context.model.min_samples_leaf = 2 #or more