Construction of a random decision tree number 0:

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

[['Warm', 'Strong', 'Cloudy', 'No'], ['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'None', 'Sunny', 'Yes'], ['Cold', 'Breeze', 'Cloudy', 'No'], ['Hot', 'Breeze', 'Cloudy', 'Yes'], ['Warm', 'Strong', 'Cloudy', 'No'], ['Hot', 'Breeze', 'Cloudy', 'Yes'], ['Hot', 'Breeze', 'Cloudy', 'Yes'], ['Cold', 'Breeze', 'Cloudy', 'No'], ['Warm', 'Breeze', 'Sunny', 'Yes']]

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 ['Temperature', 'Wind', 'Sunshine']. As there are fewer of them than the parameter m=4, we consider all of them. Of these, the variable with the highest information gain is the variable 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 Temperature, we partition the data in the current node as follows:

  • Partition for Temperature=Cold: [['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'None', 'Sunny', 'Yes'], ['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'Breeze', 'Cloudy', 'No']]
  • Partition for Temperature=Warm: [['Warm', 'Strong', 'Cloudy', 'No'], ['Warm', 'Strong', 'Cloudy', 'No'], ['Warm', 'Breeze', 'Sunny', 'Yes']]
  • Partition for Temperature=Hot: [['Hot', 'Breeze', 'Cloudy', 'Yes'], ['Hot', 'Breeze', 'Cloudy', 'Yes'], ['Hot', 'Breeze', 'Cloudy', 'Yes']]

Now, given the partitions, let us create the branches and the child nodes.

We add a child node [Temperature=Cold] to the node [root]. This branch classifies four feature(s): [['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'None', 'Sunny', 'Yes'], ['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'Breeze', 'Cloudy', 'No']].

We would like to add children to the node [Temperature=Cold].

We have the following variables available ['Wind', 'Sunshine']. As there are fewer of them than the parameter m=4, we consider all of them. Of these, the variable with the highest information gain is the variable Wind. 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 Wind, we partition the data in the current node as follows:

  • Partition for Wind=None: [['Cold', 'None', 'Sunny', 'Yes']]
  • Partition for Wind=Breeze: [['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'Breeze', 'Cloudy', 'No']]

Now, given the partitions, let us create the branches and the child nodes.

We add a child node [Wind=None] to the node [Temperature=Cold]. This branch classifies one feature(s): [['Cold', 'None', 'Sunny', 'Yes']]

We would like to add children to the node [Wind=None].

We have the following variable available['Sunshine']. As there are fewer of them than the parameter m=4, we consider all of them. Of these, the variable with the highest information gain is the variable Sunshine. 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 Sunshine, all the remaining features have the same value: Sunny. So, we end the branch with a leaf node. We add the leaf node [Play=Yes].

We add a child node [Wind=Breeze] to the node [Temperature=Cold]. This branch classifies three feature(s): [['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'Breeze', 'Cloudy', 'No'], ['Cold', 'Breeze', 'Cloudy', 'No']]

We would like to add children to the node [Wind=Breeze].

We have the following variable available ['Sunshine']. As there are fewer of them than the parameter m=4, we consider all of them. Of these, the variable with the highest information gain is the variable Sunshine. 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 Sunshine, all the remaining features have the same value: Cloudy. So, we end the branch with a leaf node. We add the leaf node [Play=No].

Now, we have added all the children nodes for the node [Temperature=Cold].

We add a child node [Temperature=Warm] to the node [root]. This branch classifies three feature(s): [['Warm', 'Strong', 'Cloudy', 'No'], ['Warm', 'Strong', 'Cloudy', 'No'], ['Warm', 'Breeze', 'Sunny', 'Yes']]

We would like to add children to the node [Temperature=Warm].

The available variables that we have still left are ['Wind', 'Sunshine']. As there are fewer of them than the parameter m=4, we consider all of them. Out of these variables, the variable with the highest information gain is the variable Wind. Thus 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 Wind, we partition the data in the current node, where each partition of the data will be for one of the new branches from the current node [Temperature=Warm]. We have the following partitions:

  • Partition for Wind=Breeze: [['Warm', 'Breeze', 'Sunny', 'Yes']]
  • Partition for Wind=Strong: [['Warm', 'Strong', 'Cloudy', 'No'], ['Warm', 'Strong', 'Cloudy', 'No']]

Now, given the partitions, let us form the branches and the child nodes.

We add a child node [Wind=Breeze] to the node [Temperature=Warm]. This branch classifies one feature(s): [['Warm', 'Breeze', 'Sunny', 'Yes']]

We would like to add children to the node [Wind=Breeze].

We have the following variable available ['Sunshine']. As there are fewer of them than the parameter m=4, we consider all of them. Of these, the variable with the highest information gain is the variable Sunshine. 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 Sunshine, all the remaining features have the same value: Sunny. So, we end the branch with a leaf node. We add the leaf node [Play=Yes].

We add a child node [Wind=Strong] to the node [Temperature=Warm]. This branch classifies two feature(s): [['Warm', 'Strong', 'Cloudy', 'No'], ['Warm', 'Strong', 'Cloudy', 'No']]

We would like to add children to the node [Wind=Strong].

We have the following variable available ['Sunshine']. As there are fewer of them than the parameter m=4, we consider all of them. Of these, the variable with the highest information gain is the variable: Sunshine. 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 Sunshine, all the remaining features have the same value: Cloudy. So, we end the branch with a leaf node. We add the leaf node [Play=No].

Now, we have added all the children nodes for the node [Temperature=Warm].

We add a child node [Temperature=Hot] to the node [root]. This branch classifies three feature(s): [['Hot', 'Breeze', 'Cloudy', 'Yes'], ['Hot', 'Breeze', 'Cloudy', 'Yes'], ['Hot', 'Breeze', 'Cloudy', 'Yes']]

We would like to add children to the node [Temperature=Hot].

We have the following variables available ['Wind', 'Sunshine']. As there are fewer of them than the parameter m=4, we consider all of them. Of these, the variable with the highest information gain is the variable Wind. 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 Wind, all the remaining features have the same value: Breeze. So, we end the branch with a leaf node. We add the leaf node [Play=Yes].

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