I'm currently studying Chapter 7 ("Modeling with Decision Trees") of the book "Programming Collective intelligence".
I find the output of the function mdclassify()
p.157 confusing. The function deals with missing data. The explanation provided is:
In the basic decision tree, everything has an implied weight of 1, meaning that the observations count fully for the probability that an item fits into a certain category. If you are following multiple branches instead, you can give each branch a weight equal to the fraction of all the other rows that are on that side.
From what I understand, an instance is then split between branches.
Hence, I simply don't understand how we can obtain:
{'None': 0.125, 'Premium': 2.25, 'Basic': 0.125}
as 0.125+0.125+2.25
does not sum to 1 nor even an integer. How was the new observation split?
The code is here:
https://github.com/arthur-e/Programming-Collective-Intelligence/blob/master/chapter7/treepredict.py
Using the original dataset, I obtain the tree shown here:
Can anyone please explain me precisely what the numbers precisely mean and how they were exactly obtained?
PS : The 1st example of the book is wrong as described on their errata page but just explaining the second example (mentioned above) would be nice.