Neural Networks Overview


Neural Networks Overview

Simon
So we've spent a lot of time on neural nets, but today I want to talk about why they aren't always the answer. There are other tools that are just as important.

Anna
Absolutely. I mean, neural nets are great for vision and language, but for a lot of real-world problems, interpretability is key. Like in election audits, you need methods that are transparent to build public confidence.

Simon
Exactly. There's a famous example from 2008 where Philip Stark chose simple methods for election auditing because complex ones would face resistance. And it's not just about non-experts—even machine learning experts benefit from interpretability.

Anna
Right, like that medical example where a neural net said asthma patients had lower pneumonia risk. An interpretable model revealed it was because those patients got aggressive ICU care—a classic Simpson's paradox.

Simon
And that's where decision trees shine. They're a series of yes/no questions that anyone can follow. For instance, a tree for heart attack risk uses blood pressure, age, and sinus tachycardia to classify patients.

Anna
So a decision tree is a binary tree where each internal node splits on a feature, and leaves give a prediction. For classification it's a class label, for regression it's a constant value.

Simon
Exactly. And these splits are axis-aligned—they partition the feature space into rectangles. That's why regression trees produce step functions. The parameters are the split dimensions, split values, and leaf labels.

Anna
But how do we learn a tree? It's not differentiable like a neural net. We need a heuristic. The classic approach is greedy growth: recursively pick the best split that minimizes squared error.

Simon
Right. For regression with squared error, the best prediction in a leaf is the average of the target values. To find the best split, we try each feature and consider split points between data points—that's finite.

Anna
But greedy growth can overfit. A common fix is to grow a large tree and then prune it back using cost-complexity pruning, where we trade off training loss and number of leaves.

Simon
Exactly. Pruning penalizes extra leaves, so we can remove subtrees that don't improve loss. Cross-validation then picks the best tree. This gives us better generalization.

Anna
But even pruned trees aren't as accurate as ensembles. That's when we combine many trees. Bagging, or bootstrap aggregating, creates multiple datasets by sampling with replacement, trains a tree on each, and averages the predictions.

Simon
And random forests take it further. They add extra randomness: when splitting, instead of considering all features, you only consider a random subset. This makes the trees less correlated, which improves the ensemble.

Anna
So random forests have great predictive performance, often better than neural nets on tabular data. That's why they're top on Kaggle. But we lose interpretability—you can't easily explain a forest of hundreds of trees.

Simon
Right. So it's a trade-off: decision trees for interpretability, random forests for accuracy. And it's why these tools are essential in your machine learning toolbox.

Ask anything
We've read this whole study set, so questions about it get the best answers.