News for hackers. Stuff that matters.
Re:The Unreasonable Effectiveness of Random Forests by shoo on Saturday September 19, 2015 @04:46AM (#10243729)
(I) Indeed, it is a pretty good trick, and is simple to implement, given that the algorithm for evaluating a random forest is simple. Good on you for implementing it nicely for scikit-learn, benchmarking it, and making the code available.

I did something similar a few years ago when using a random forest as a heuristic to speed-up some minimax game tree search code. I don't think I still have the python scripts used to generate the compiled code (no great loss, they would have been terrible throwaway code) but amusingly enough I still have an example of a compiled random forest:

(warning: link #2 is a ~44k line cpp file of gotos encoding 50 compiled decision trees)

    1. https://raw.githubusercontent.com/fcostin/hangman_cpp/master/forest.h
    2. https://raw.githubusercontent.com/fcostin/hangman_cpp/master/forest.cpp
This probably isn't the fastest possible encoding of a bunch of decision trees, but it was pretty quick.

(II) On a different note, the article states "Another point that some might find a concern is that random forest models are black boxes that are very hard to interpret.". Well, yes and no. Decision trees are pretty easy to interpret -- you can always pick out one of the decision trees and look at it.

If one is interested in learning more about random forests I'd recommend taking a look at these notes from Breiman and Cutler (the folks responsible for the algorithm!): https://www.stat.berkeley.edu/~breiman/RandomForests/cc_home...

E.g. they discuss "variable importance" measures, as featured in the original R version of randomForest. There are a bunch of tools built around random forests for extracting some insight beyond the raw predictions, to aid interpretation! Use them! https://www.stat.berkeley.edu/~breiman/RandomForests/cc_home...

(III) Final comment: the article doesn't mention the Bayesian interpretation of ensembling a bunch of statistical models together. That's another potentially insightful way of thinking about why the method might be effective, and isn't limited to decision trees.

There are no comments on this comment yet.