Construction of random decision tree number 0

We are given six features as the input data. Out of these, we choose randomly six features with replacement for the construction of this random decision tree:

[['None', 'Warm', 'No'], ['None', 'Warm', 'No'], ['Small', 'Cold', 'No'], ['Good', 'Cold', 'No'], ['Good', 'Cold', 'No'], ['Good', 'Cold', 'No']]

We start the construction with the root node to create the first node of the tree. We would like to add children to the node [root].

We have the following variables available ['swimming_suit', '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 swimming suit.

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 swimming_suit, we partition the data in the current node as follows:

  • Partition for swimming_suit=Small: [['Small', 'Cold', 'No']]
  • Partition for swimming_suit=None: [['None', 'Warm', 'No'], ['None', 'Warm', 'No']]
  • Partition for swimming_suit=Good: [['Good', 'Cold', 'No'], ['Good', 'Cold', 'No'], ['Good', 'Cold', 'No']]

Using the preceding partitions, we create the branches and the child nodes.

We now add a child node [swimming_suit=Small] to the node [root]. This branch classifies one feature(s): [['Small', 'Cold', 'No']].

We would like to add children to the node [swimming_suit=Small].

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. For the chosen variable water_temperature, all the remaining features have the same value: Cold. So, we end the branch with a leaf node. We add the leaf node [swim=No].

We now add a child node [swimming_suit=None] to the node [root]. This branch classifies two feature(s): [['None', 'Warm', '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. For the chosen variable water_temperature, all the remaining features have the same value: Warm. So, we end the branch with a leaf node. We add the leaf node [swim=No].

We now add a child node [swimming_suit=Good] to the node [root]. This branch classifies three feature(s): [['Good', 'Cold', 'No'], ['Good', 'Cold', 'No'], ['Good', 'Cold', 'No']]

We would like to add children to the node [swimming_suit=Good].

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. For the chosen variable water_temperature, all the remaining features have the same value: Cold. So, we end the branch with a leaf node. We add the leaf node [swim=No].

Now, we have added all the children nodes for the node [root].

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset