Probability computation

In the notebook you say:

We will manually compute the different probability directly from the tree structure.

adelie_proba = 103 / 161
chinstrap_proba = 52 / 161
gentoo_proba = 6 / 161
print(
    f"Probabilities for the different classes:\n"
    f"Adelie: {adelie_proba:.3f}\n"
    f"Chinstrap: {chinstrap_proba:.3f}\n"
    f"Gentoo: {gentoo_proba:.3f}\n"
)

I don’t know what are 103, 52 and 6 and how you computed them? Can you guide me please!

When we train the decision tree with max_depth=1 we find the following that predictions are made according to the following rule:

tree

We observe 103 Adelie samples in the upper half of the decision boundary. We also count 52 Chinstrap samples and 6 Gentoo samples in this region, accounting for a total of 161 samples.

1 Like