In the last two posts, LVQ and Machine Learning for Algorithmic Traders – Part 1, and LVQ and Machine Learning for Algorithmic Traders – Part 2, we demonstrated how to use:
..to determine the relevance/importance of and correlation between strategy parameters respectively.
Yet another technique we can use to estimate the best features to include in our trading strategies or models, is called Recursive Feature Elimination, an automatic feature selection approach.
It enables algorithmic traders to construct multiple quantitative models using different segments of a given dataset, allowing them to identify which combination of features or strategy parameters results in the most accurate model.
One such method of automatic feature selection is Recursive Feature Elimination (RFE).
To evaluate the best feature-space for an accurate model, the technique iteratively applies a Random Forest algorithm to all possible combinations of the input feature data (strategy parameters).
The end-outcome is a list of features that produce the most accurate model.
Using RFE, algorithmic traders can refine and speed up trading strategy optimization significantly (subject to this list being smaller than the total number of input parameters of course).
We’ll make use of the caret (Classification and Regression Training) package in R once again.
It contains functions to perform RFE conveniently, allowing us to spend more time in analysis instead of writing the functionality ourselves.
> train.blogpost <- read.csv("data.csv", head=T, nrows=1000)
> train.blogpost <- train.blogpost[,grep("feature|target",names(train.blogpost))]
> rfe.control <- rfeControl(functions=rfFuncs, method="cv", number=10)
rfe.output <- rfe(train.blogpost[,1:21], train.blogpost[,22], sizes=c(1:21), rfeControl = rfe.control)
> plot(rfe.output, type=c("o", "g"))
From these results, it is easily apparent that a model with:
Based on this, an algorithmic trader could significantly reduce his/her optimization overhead, by culling the number of strategy parameters employed in backtesting and optimization.
Additional Resource: Measuring Investments’ Risk: Value at Risk (VIDEO)
* please activate CC mode to view subtitles.
Do you have what it takes? – Join the Darwinex Trader Movement!