# Usage of Random forests in Quantitative analysis of stocks

I have a question about Random forests and how they could be utilized in trading? I heard Random forests are used for classification, is that accurate? If so, could someone give an example of what sort of classification does it help with?

If not, what are Random forests used for in Quant finance?

-
Please consider registering on the site. –  SRKX Feb 1 '13 at 9:10

I have not used random forests myself but I know of a guy who applied this classification technique to machine learning algorithms applied to pattern recognition.

Thus I think its advantages over classic regression approaches can be applied to discern patterns in financial data, though I get the impression that it vastly overfits the data and thus you end up with the classical trade-off that many quants are faced with.

I also read that it is used by the SEC where they apply it in their quest to analyze trading patterns to flag insider trading violations.

-

As with many machine learning technologies, you can run a separate training and testing phase before deploying it live for prediction. All it does is build a collection of decision trees based on the parameters you give it - if the output field is a factor, you get classification (a finite enumerated set of values); if it's numeric, you get prediction. One approach might be to add a column forwhether a commodity reaches a given profit level within an affordable time period; the random forest can then build a logic to correlate that against all the other input columns (such as technical indicators, etc).

-

A while ago I have implemented a binary fuzzy decision tree forest to classify credit applications as a semesters project.

Let's say a tree looks like this:

C1
C11
-> X
-> Y
C12
C121
-> A
-> B
-> U


The benefits of decision tree techniques in general are:

• Comprehensibility: The paths down the tree have a direct interpretation: "If condition C1 and condition C11 then X". For example "If debt>0 and income == 0 then no_credit."
• Expert knowledge: It is possible to change the trees based on background knowledge.
• Extensibility: It is possible to include other classification tools at the nodes, for example you could have a neural network which detects trends and then go down the tree depending on the output of the network.

Decicion tree forests have additional benefits:

• Adaptation: If the problem splits into several domains, the trees can fit to their region more closely.
• Smaller trees: The trees can be restricted to much smaller size, which makes them easier to understand.
• Confidence information: If a lot of the trees in the forrest vote for the same classification, this can be seen as a measure of confidence.

On the downside forests can be much more expensive to compute and manage. Also, whereas a single tree can avoid overfitting by using standard pruning techniques, there does not seem to be concensus which is the best approach for forrests, yet.

Any application of machine learning techniques this approach is only as good as the data and the indicators used to train it on.

Interesting papers include

-