Knowee
Questions
Features
Study Tools

Illustrate the working of Descision Tree Algorithm with the help of suitable example

Question

Illustrate the working of Descision Tree Algorithm with the help of suitable example

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, let's understand the working of the Decision Tree Algorithm with a simple example.

Suppose we have a dataset of weather conditions and we want to predict if a game can be played or not based on these conditions. The dataset is as follows:

Outlook Temperature Humidity Windy Play
Sunny Hot High False No
Sunny Hot High True No
Overcast Hot High False Yes
Rainy Mild High False Yes
Rainy Cool Normal False Yes
Rainy Cool Normal True No
Overcast Cool Normal True Yes
Sunny Mild High False No
Sunny Cool Normal False Yes
Rainy Mild Normal False Yes
Sunny Mild Normal True Yes
Overcast Mild High True Yes
Overcast Hot Normal False Yes
Rainy Mild High True No

Step 1: Calculate the entropy of the target.

Step 2: The dataset is then split on the different attributes. The entropy for each branch is calculated. Then it is added proportionally, to get total entropy for the split. The resulting entropy is subtracted from the entropy before the split. The result is the Information Gain, or decrease in entropy.

Step 3: Choose attribute with the largest information gain as the decision node, divide the dataset by its branches and repeat the same process on every branch.

Step 4: A branch with entropy of 0 is a leaf node.

Step 5: A branch with entropy more than 0 needs further splitting.

Step 6: The Decision Tree is built, and prediction is made with the help of this tree.

The decision tree for the above data will look something like this:

Outlook
|--- Sunny
|    |--- Humidity
|    |    |--- High: No
|    |    |--- Normal: Yes
|--- Overcast: Yes
|--- Rainy
|    |--- Windy
|    |    |--- False: Yes
|    |    |--- True: No

This tree can be used to predict whether a game can be played or not based on the weather conditions.

This problem has been solved

Similar Questions

- Provide a detailed algorithm for the Inorder tree traversal method. explain the answer for 5 marks

If the tree is not a complete binary tree then what changes can be made for easy access to the children of a node in the array?Marks : 2Negative Marks : 0

Explain in detail the round structure of DES Algorithm with proper representation.

Explain the process of inserting nodes into a binary search tree.give the answer for 5 marks

You are given an undirected graph of N nodes and M edges. Return 1 if the graph is a tree, else return 0.

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.