BeginnerAbout 20 min

    Decision Tree

    Read the full article on Substack

    6 min read.

    The foundation of Random Forests and XGBoost! Learn how decision trees recursively split data using information gain, Gini impurity, and entropy. Watch the tree grow and classify data interactively.

    Max depth2
    xy
    yesnox ≤ 6.25[11, 11]gini 0.500yesnoy ≤ 1.25[10, 4]gini 0.408Class 1[0, 1]gini 0.000Class 0[10, 3]gini 0.355yesnoy ≤ 6.25[1, 7]gini 0.219Class 0[1, 1]gini 0.500Class 1[0, 6]gini 0.000

    Depth 2: 3 splits, 4 leaves, 18 of 22 training points right. Outlined points are the ones it gets wrong.

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Grow one node

    Sequence

    Order how a tree chooses a split.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    5 pieces left to place

    Quiz

    20 questions
    Question 1 of 20
    Score: 0

    A decision tree makes predictions by…

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going