How To Choose Root Node For Decision Tree?
Table Of Contents:
- How To Choose Root Node For Decision Tree?
How To Choose Root Node For Decision Tree?
- Let’s build a decision tree for a dataset to decide whether to Play Tennis based on conditions like weather, temperature, humidity, and wind.
Step-1: Calculate The Overall Entropy
- Overall entropy tells us how much dataset is disordered initially.
Step-2: Calculate Information Gain For Each Attribute.
- We now calculate the Information Gain for each attribute by splitting the dataset based on its values.
Step-3: Choose the Attribute With The Highest Information Gain
- The attribute Weather has the highest Information Gain (0.247). Therefore, it is chosen as the root node.
Step-4: Split the Dataset Based on Weather
After choosing Weather as the root node, the dataset is split into subsets for Sunny, Overcast, and Rainy.
The process is then repeated recursively for each subset to build the full decision tree.
