logoalt Hacker News

Decision trees – the unreasonable power of nested decision rules

496 pointsby mschnellyesterday at 8:55 AM77 commentsview on HN

Comments

sreanyesterday at 1:11 PM

A 'secret weapon' that has served me very well for learning classifiers is to first learn a good linear classifier. I am almost hesitant to give this away (kidding).

Use the non-thresholded version of that linear classifier output as one additional feature-dimension over which you learn a decision tree. Then wrap this whole thing up as a system of boosted trees (that is, with more short trees added if needed).

One of the reasons why it works so well, is that it plays to their strengths:

(i) Decision trees have a hard time fitting linear functions (they have to stair-step a lot, therefore need many internal nodes) and

(ii) linear functions are terrible where equi-label regions have a recursively partitioned structure.

In the decision tree building process the first cut would usually be on the synthetic linear feature added, which would earn it the linear classifier accuracy right away, leaving the DT algorithm to work on the part where the linear classifier is struggling. This idea is not that different from boosting.

One could also consider different (random) rotations of the data to form a forest of trees build using steps above, but was usually not necessary. Or rotate the axes so that all are orthogonal to the linear classifier learned.

One place were DT struggle is when the features themselves are very (column) sparse, not many places to place the cut.

show 5 replies
lokimedesyesterday at 12:20 PM

When I worked at CERN around 2010, Boosted Decision Trees were the most popular classifier, exactly due to the (potential for) explainability along with its power of expression. We had a cultural aversion for neural networks back then, especially if the model was used in physics analysis directly. Times have changed…

show 3 replies
huqedatoyesterday at 2:13 PM

Random forests on the same site: https://mlu-explain.github.io/random-forest/

show 2 replies
fookeryesterday at 11:07 AM

Fun fact - single bit neural networks are decision trees.

In theory, this means you can 'compile' most neural networks into chains of if-else statements but it's not well understood when this sort of approach works well.

show 3 replies
jebarkeryesterday at 5:14 PM

The killer feature of DTs is how fast they can be. I worked very hard on a project to try and replace DT based classifiers with small NNs in a low latency application. NNs could achieve non-trivial gains in classification accuracy but remained two orders of magnitude higher latency at inference time.

zelphirkaltyesterday at 11:48 AM

Decision trees are great. My favorite classical machine learning algorithm or group of algorithms, as there are many slight variations of decision trees. I wrote a purely functional (kind of naive) parallelized implementation in GNU Guile: https://codeberg.org/ZelphirKaltstahl/guile-ml/src/commit/25...

Why "naive"? Because there is no such thing as NumPy or data frames in the Guile ecosystem to my knowledge, and the data representation is therefore probably quite inefficient.

show 1 reply
levocardiatoday at 2:19 AM

One of the ML textbooks (ESL maybe?) I read described decision trees as (paraphrasing) "really great - they are interpretable, fast to fit, work on lots of different types of data and outcomes, insensitive to scaling and distributional issues, don't have too many tuning parameters...except they just don't work very well." That latter problem can be solved with bagging or boosting, though you are bargaining away many of the other advantages.

kqryesterday at 11:50 AM

Experts' nebulous decision making can often be modelled with simple decision trees and even decision chains (linked lists). Even when the expert thinks their decision making is more complex, a simple decision tree better models the expert's decision than the rules proposed by the experts themselves.

I've long dismissed decision trees because they seem so ham-fisted compared to regression and distance-based clustering techniques but decision trees are undoubtedly very effective.

See more in chapter seven of the Oxford Handbook of Expertise. It's fascinating!

show 1 reply
getpokedagainyesterday at 2:59 PM

I worked (professionally) on a product a few years ago based upon decision tree and random forest classifiers. I had no background in the math and had to learn this stuff which has payed dividends as llms and AI have become hyped. This is one of the best explanations I've seen and has me super nostalgic for that project.

Gonna try to cook up something personal. It's amazing how people are now using regression models basically all the time and yet no-one uses these things on their own.

show 1 reply
hkbuildsyesterday at 9:34 PM

Decision trees are underrated in the age of deep learning. They're interpretable, fast, and often good enough.

I've been using a scoring system for website analysis that's essentially a decision tree under the hood. Does the site have a meta description? Does it load in under 3 seconds? Is it mobile responsive? Each check produces a score, the tree aggregates them. Users understand why they got their score because the logic is transparent.

Try explaining why a neural network rated their website 73/100. Decision trees make that trivial.

show 1 reply
xmprtyesterday at 9:56 AM

Interesting website and great presentation. My only note is that the color contrast of some of the text makes it hard to read.

show 1 reply
ayhanfuatyesterday at 5:03 PM

I am surprised r2d3's visual intro is not referenced here (https://r2d3.us/visual-intro-to-machine-learning-part-1/). I think it was the first (if not first, maybe most impactful) example for scroll triggered explainers.

moi2388yesterday at 11:05 AM

That was beautifully presented!

ssttooyesterday at 7:35 PM

I just wish we’d stop with the “unreasonable” click-bite. Cheapens an otherwise excellent article, like “7 x (number 6 will surprise you)” of yesteryear

EGregyesterday at 2:47 PM

Isn’t that exactly how humans (and even animals) operate?

Human societies look for actual major correlations and establish classifications. Except with scientific-minded humans, we often also want, to know the why behind the correlations. David Hume got involved w that… https://brainly.com/question/50372476

Let me ask a provocative question. What, ultimately, is the difference between knowledge and bias?

show 1 reply
uoaeitoday at 12:22 AM

They're rough approximations of conditioned distributions qua Bayesian statistics. You may treat them as such.

Hence why random forests have such enduring power.

jwilbertoday at 12:05 AM

Looks great, if I remember correctly the author mentioned that the spring color palette + fruit examples are a bit tongue-in-cheek.

Jaxon_Varryesterday at 9:57 AM

[dead]

bobekyesterday at 7:41 PM

Wow. This page is actually a product of LLM [0]. So they can produce useful stuff after all :)

[0]: https://news.ycombinator.com/item?id=47195123

show 1 reply