Back to the 2023 paper

Module 3: Classification Algorithms

202314m

For the Sun Burn data set given below, construct a decision tree.

Name Hair Height Weight Location Class
Sunita Blonde Average Light No Yes
Anita Blonde Tall Average Yes No
Kavita Brown Short Average Yes No
Sushma Blonde Short Average No Yes
Xavier Red Average Heavy No Yes
Balaji Brown Tall Heavy No No
Ramesh Brown Average Heavy No No
Sweta Blonde Short Light Yes No
Worked SolutionAI Assisted

Sun Burn Decision Tree Construction (ID3 style):

Dataset: 8 examples, 4 attributes + Class {Yes=3, No=5}
Entropy H(S)=−(3/8)log⁡2(3/8)−(5/8)log⁡2(5/8)=0.954H(S)= - (3/8)\log_2(3/8) - (5/8)\log_2(5/8)=0.954

Evaluate each attribute Information Gain.

Similar exhaustive calc shows Hair or Height gives high gain. Manual computation:

  • Hair: Blonde (4 ex: 2Y,2N) H=1H=1, Brown (3 ex:0Y,3N) H=0H=0, Red (1 ex:1Y,0N) H=0H=0 → Weighted =4/8∗1=0.5=4/8*1=0.5 → Gain =0.954−0.5=0.454=0.954-0.5=0.454
  • Weight & Location similar calculations, Hair best initially.

Root: Hair

  • Hair=Brown → Leaf No (3/3, pure)
  • Hair=Red → Leaf Yes (1/1)
  • Hair=Blonde (4 ex remains: Sunita Y, Anita N, Sushma Y, Sweta N) — need further split on remaining attributes (Height, Weight, Location).

Subset Blonde SBS_B: 2Y/2N H=1H=1

  • Height: Tall 1N, Average 1Y, Short 1Y+1N (H=1H=1) → Gain small
  • Weight: Light 1Y1N (H=1H=1), Average 2 examples 1Y1N → no gain
  • Location: No → 2Y (Sunita,Sushma) pure Yes; Yes →2N (Anita,Sweta) pure No → Weighted entropy 00 → Gain =1=1

So next split Location.

Resulting Tree:

Hair?
├─ Brown → No
├─ Red → Yes
└─ Blonde → Location?
           ├─ No → Yes (Sunita,Sushma)
           └─ Yes → No (Anita,Sweta)

Alternative equivalent tree with Weight/Height may also achieve pure leaves but Location gives perfect split for this subset. This tree classifies all 8 training examples correctly (100% training accuracy).

If using Gini/C4.5, structure similar; root may be Location then Hair depending tie-breaking; any fully consistent tree with 3 leaves is acceptable. Pruning not needed due small data.

Interpretation: For this data, Hair color and absence of Location (No) predicts Sun Burn Yes in blondes.

Similar questions

Data MiningBuild a decision tree using the training data in the table given below. Divide the height attribute into ranges as follows: [0, 1.6], \quad [1.6, 1.7], \quad [1.7, 1.8], \quad [1.8, 1.9], \quad [1.9, 2.0], \quad [2.0, 5.0] | Gender | Height (m) | Class | | :---: | :---: | :---: | | F | 1.6 | Short | | M | 2 | Tall | | F | 1.9 | Medium | | F | 1.88 | Medium | | F | 1.7 | Short | | M | 1.85 | Medium | | F | 1.6 | Short | | M | 1.7 | Short | | M | 2.2 | Tall | | M | 2.1 | Tall | | F | 1.8 | Medium | | M | 1.95 | Medium | | F | 1.9 | Medium | | F | 1.8 | Medium | | F | 1.75 | Medium |20237mData MiningBuild a decision tree using the training data in the table given below. Divide the height attribute into ranges as follows : \{0, 1.6\], (1.6, 1.7\], (1.7, 1.8\], (1.8, 1.9\], (1.9, 2.0\], (2.0, 5.0\] | Gender | Height (m) | Class | |:---:|:---:|:---:| | F | 1.6 | Short | | M | 2 | Tall | | F | 1.9 | Medium | | F | 1.88 | Medium | | F | 1.7 | Short | | M | 1.85 | Medium | | F | 1.6 | Short | | M | 1.7 | Short | | M | 2.2 | Tall | | M | 2.1 | Tall | | F | 1.8 | Medium | | M | 1.95 | Medium | | F | 1.9 | Medium | | F | 1.8 | Medium | | F | 1.75 | Medium |20218mData MiningDraw decision tree for the following data sets. Use entropy as a node selection mechanism: | Outlook | Temp (F) | Humidity | Windy | Class | |:---|:---|:---|:---|:---| | Rainy | Hot | High | False | No | | Rainy | Hot | High | True | No | | Overcast | Hot | High | False | Yes | | Sunny | Mild | High | False | Yes | | Sunny | Cool | Normal | False | Yes | | Sunny | Cool | Normal | True | No | | Overcast | Cool | Normal | True | Yes | | Rainy | Mild | High | False | No | | Rainy | Cool | Normal | False | Yes | | Sunny | Mild | Normal | False | Yes | | Rainy | Mild | Normal | True | Yes | | Overcast | Mild | High | True | Yes | | Overcast | Hot | Normal | False | Yes | | Sunny | Mild | High | True | No |202014mMACHINE LEARNINGApply the ID3 algorithm on the following data to draw a decision tree. Show the Information Gain at each split. ### Dataset | Outlook | Temperature | Humidity | Windy | PlayTennis | |-----------|-------------|----------|-------|-------------| | 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 |202510m
AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.