topskill.dev
CoursesTracks
All courses/Machine Learning FundamentalsDecision trees
Supervised prediction algorithms
5 / 10
← Machine Learning Fundamentals
○What machine learning learns○Features and labels○Training and inference○Regression or classification○The machine learning process○Data quality and coverage○Representing data✦Module Quiz
○Linear regression○Try a tiny linear model○Logistic regression○Nearest neighbors●Decision trees○Random forests○Boosting○Naive Bayes○Support vector machines✦Module Quiz
○Clustering○K-means○Choosing and interpreting clusters○Principal component analysis○Neural networks and deep learning○Self-supervised learning○Transfer learning○Reinforcement learning✦Module Quiz
○Generalization and overfitting○Holding out evaluation data○Data leakage○Baselines○Bias and variance intuition○Reading learning curves✦Module Quiz
○Prediction errors and residuals○Measuring regression error○Squared error and large misses○The confusion matrix○Precision and recall○Try a held-out classifier✦Module Quiz
○Bias and limits○Monitoring and drift○Comparing models for a decision✦Module Quiz
Supervised prediction algorithms

Decision trees

A decision tree makes a prediction by following questions from a starting node to an endpoint, called a leaf. Each question splits the cases into branches. A training algorithm chooses splits that make the resulting groups more useful for prediction.

Follow the toy tree for a 5-kilometer trip with a short queue: the distance answer is no, then the queue answer is no, so the prediction is on time. The thresholds are invented to explain the mechanism, not fitted evidence about delivery performance.

A classification leaf can predict the common label among training examples reaching it. A regression leaf can predict their average numerical target. The same question-and-branch idea supports both tasks.

A shallow tree is often easy to inspect. A deep tree can create tiny groups that reflect accidents in the training records rather than reliable patterns. Limiting depth or requiring more examples in each leaf can reduce that risk. Even a readable tree is not automatically a causal explanation: its questions describe predictive associations.

Training selects both which feature to ask about and the cutoff value. Prediction only follows the learned path; it does not search for new splits. A tree with one split is sometimes called a decision stump. The later classification demonstration deliberately uses one split so its mistakes are easy to inspect.

Check your understanding

Does a tree need to ask every question in the diagram for each case?

Answer: No. It follows only the branch selected at each question until it reaches a leaf.

Fact 1
1 / 1
FACT 1

No. It follows only the branch selected at each question until it reaches a leaf.