Back to the lessonPreparing the printout…

Fundamental of Machine Learning · Module 2: Core Machine Learning Algorithms

Decision Trees

[markdown] content available only on the platform

[markdown] content available only on the platform

Flashcards · Decision Trees

Decision path — The sequence of questions from the root to a leaf that explains one prediction.

credit_rating = fair -> income = low -> Reject.

Gini impurity — 1 minus the sum of squared class proportions in a branch; 0 is pure, 0.5 is a 50/50 mix.

3 Yes, 2 No -> 0.48

plot_tree() — A scikit-learn function that draws a fitted decision tree with its questions and leaves.

plot_tree(model, feature_names=x.columns, filled=True)

Overfitting (tree) — An unlimited tree memorises training rows, scoring 100% on train but poorly on test.

Train 100%, test 71%.

max_depth — The maximum number of levels a tree may grow; the first parameter to adjust when a tree overfits.

DecisionTreeClassifier(max_depth=4)

min_samples_leaf — The minimum number of samples every leaf must contain, which prevents tiny, over-specific leaves.

DecisionTreeClassifier(min_samples_leaf=5)

min_samples_split — The minimum number of samples a node needs before it is allowed to split.

DecisionTreeClassifier(min_samples_split=10)

Interpretability trade-off — Random Forest gains stability over a single tree but loses most of its readability.

One tree explains a loan; 300 voting trees do not.

Fundamental of Machine Learning · Decision Trees · printed on November 21, 2026