Page 93 - Data Science Algorithms in a Week
P. 93
Random Forest
We add a child node [swimming_suit=None] to the node [root]. This branch classifies
three feature(s): [['None', 'Warm', 'No'], ['None', 'Cold', 'No'], ['None',
'Warm', 'No']].
We would like to add children to the node [swimming_suit=None].
We have the following variable available ['water_temperature']. As there are fewer of
them than the parameter m=3, we consider all of them. Of these, the variable with the
highest information gain is the variable water_temperature. Therefore, we will branch
the node further on this variable. We also remove this variable from the list of the available
variables for the children of the current node. Using the variable water temperature, we
partition the data in the current node as follows:
Partition for water_temperature=Cold: [['None', 'Cold', 'No']]
Partition for water_temperature=Warm: [['None', 'Warm', 'No'],
['None', 'Warm', 'No']] Now, given the partitions, let us create the
branches and the child nodes.
We add a child node [water_temperature=Cold] to the node [swimming_suit=None].
This branch classifies one feature(s): [['None', 'Cold', 'No']].
We do not have any available variables on which we could split the node further; therefore,
we add a leaf node to the current branch of the tree. We add the leaf node [swim=No].
We add a child node [water_temperature=Warm] to the node [swimming_suit=None].
This branch classifies two feature(s): [['None', 'Warm', 'No'], ['None', 'Warm',
'No']].
We do not have any available variables on which we could split the node further; therefore,
we add a leaf node to the current branch of the tree. We add the leaf node [swim=No].
Now, we have added all the children nodes for the node [swimming_suit=None].
We add a child node [swimming_suit=Good] to the node [root]. This branch classifies
two feature(s): [['Good', 'Warm', 'Yes'], ['Good', 'Cold', 'No']]
We would like to add children to the node [swimming_suit=Good].
[ 81 ]