In this article, we will talk about class 9 AI How to make a decision tree in easy steps. In previous article modelling, we have seen Decision Tree helps a lot in modelling to take the right decision. The decision tree is one of the most common and basic models in the data science field. So let us start!
Class 9 AI How to make a decision tree in 4 easy steps
As you know the decision tree is an example of a rule-based approach. The structure of decision starts with the root node and ends with leaves by connecting branches having different conditions. So following things you have to keep in mind before making the decision tree:
- Observe your data carefully.
- Decide what (data) will be your root
- Decide what (data) will be your leaves
- Now analyze the data properly and find out some unnecessary data
Observe the following picture given, it is a decision tree given CBSE study material. It is very important for Class 9 AI How to make a decision tree topic:
In the above picture, one decision tree is given. Here the decision is something which is related to our daily activity. The first condition is about you are hungry or not? If yes then if you have $25 you can go to the restaurant and if no then you can buy a burger or if you are not hungry then you can go to sleep. So the top question or condition here is – Am I Hungry? will be considered as root and Yes or no will be branches. The final decision like go to sleep, go to a restaurant and buy burger are leaves. Have I $25 is the interior node.
Based on this decision tree two questions are given in the curriculum handbook and here I will provide you the answers:
- How many branches does the tree shown above have? – 2
- How many leaves does the tree shown above have? – 3
Points to remember
While making a decision tree, remember following points:
- Give a good look to your dataset
- Try to figure out the pattern of your output leaf
- Select any one output and find out the common links for similar output
- Note the the parameters for redundant data from the dataset
- Choose the simple dataset for your decision tree
Now let we see one more example given in the CBSE study material as given dataset:
The following is a dataset comprising of 4 parameters which lead to the prediction of whether
an Elephant would be spotted or not. The parameters which affect the prediction are:
Outlook, Temperature, Humidity and Wind. Draw a Decision Tree for this dataset.
Common decisions are as following:
- If outlook = Sunny and Humidity = High, then Elephant Spotted = No
- If outlook = Sunny and Humidity = Normal, then Elephant Spotted = Yes
- If outlook = overcast, then Elephant Spotted = Yes
- If outlook = Rain and wind= Strong, then Elephant Spotted = No
- If outlook = Rain and wind = weak, then Elephant Spotted = Yes
Similarly you can prepare any decision tree according to given dataset. So here we conclude this topic Class 9 AI How to make a decision tree.
If you want to use an online website to draw decision trees you can use one of the following online apps:
Click below given link to access all contents of AI class 9.
Thank you for reading this article Class 9 AI How to make a decision tree, I hope it will help you understand the concept. If you have any queries related to this, let us know through the comment section.
You can share your feedback/views/suggestions as well through the comment section.