Classification Tree Questions and Answers

This set of Machine Learning Multiple Choice Questions & Answers (MCQs) focuses on “Classification Tree”.

1. Categorical Variable Decision tree has a categorical target variable.
a) True
b) False
View Answer

Answer: a
Explanation: Decision tree is an algorithm having a predefined target variable that is mostly used in classification problems. If the target variable is a categorical target variable then such type of classification tree is known as Categorical Variable Decision tree.

2. Which of the following statements is not true about the Classification tree?
a) It is used when the dependent variable is categorical
b) It divides the predictor space into distinct and non overlapping regions
c) It divides the independent variables into distinct and non overlapping regions
d) It is used when the dependent variable is continuous
View Answer

Answer: d
Explanation: Classification trees are used when the dependent variable is categorical not continuous. And it divides the predictor space (independent variables) into distinct and non overlapping regions.

3. In Classification trees the value obtained by terminal node in the training data is the mode of observations falling in that region.
a) True
b) False
View Answer

Answer: a
Explanation: In Classification trees the value obtained by terminal node in the training data is the mode of observations falling in that region. And this value obtained by terminal node is known as the class. So if an unseen data observation falls in that region, it will make its prediction with mode value.
advertisement
advertisement

4. Classification trees follow a top-down greedy approach.
a) True
b) False
View Answer

Answer: a
Explanation: Classification tree follows a top-down greedy approach known as recursive binary splitting. It begins from the top of tree when all the observations are available in a single region and successively splits the predictor space into two new branches down the tree. It is known as greedy because the algorithm cares only about the current split, and not about future splits which will lead to a better tree.

5. Which of the following statements is not true about Classification trees?
a) It labels, records, and assigns variables to discrete classes
b) It can also provide a measure of confidence that the classification is correct
c) It is built through a process known as binary recursive partitioning
d) It will always looks for the best variable available in the future splits for a better tree
View Answer

Answer: d
Explanation: In classification trees it will always look for the best variable available in the current split and not in the future splits for a better tree and it is built through a process known as binary recursive partitioning. It labels, records, and assigns variables to discrete classes and it can also provide a measure of confidence that the classification is correct.

6. Which of the following statements are not true about the Classification trees?
a) The target variable can take a discrete set of values
b) The leaves represent class labels
c) The branches represent conjunctions of features
d) The target variable can take real numbers
View Answer

Answer: d
Explanation: In classification trees, the target variable cannot take real numbers but can take only a discrete set of values. Here the leaves represent class labels and the branches represent conjunctions of features that will lead to those class labels.

7. Which of the following statements is not true about CART?
a) It is used for generating regression tree
b) It is used for generating classification tree
c) It is used for binary classification
d) It always uses Gini index as cost function to evaluate split in feature selection
View Answer

Answer: d
Explanation: It uses Gini index as a cost function to evaluate split in feature selection in case of classification tree and it uses least square as a metric to select features in case of Regression tree. So it is used for generating both classification and regression trees. And it is used for binary classification also.
advertisement

8. From the below table where the target is to predict play or not (Yes or No) based on weather condition, what is the Gini index for Climate = Sunny?

Day Climate Temperature Wind Decision
1 Sunny Cool Strong Yes
2 Sunny Hot Weak No
3 Rainy Medium Weak Yes
4 Winter Cool Weak Yes
5 Rainy Cool Strong No
6 Winter Cool Strong No
7 Sunny Hot Strong No

a) 0.45
b) 0.49
c) 0.47
d) 0.43
View Answer

Answer: a
Explanation: From the given table we have:

Climate Yes No Instances
Sunny 1 2 3
advertisement

Gini index = 1 – ∑\(_{i=1} ^{n}\)p\(_{i} ^{2}\)
= 1 – ((1/3)2 + (2/3)2)
= 1 – (0.11 + 0.44)
= 1 – 0.55
= 0.45

9. From the below table where the target is to predict play or not (Yes or No) based on weather condition, the Gini index for Climate = Rainy and Climate = Winter are the same.

Day Climate Temperature Wind Decision
1 Sunny Cool Strong Yes
2 Sunny Hot Weak No
3 Rainy Medium Weak Yes
4 Winter Cool Weak Yes
5 Rainy Cool Strong No
6 Winter Cool Strong No
7 Sunny Hot Strong No

a) True
b) False
View Answer

Answer: a
Explanation: From the given table we have:

Climate Yes No Instances
Rainy 1 1 2
Winter 1 1 2

Gini index = 1 – ∑\(_{i=1} ^{n}\)p\(_{i} ^{2}\). Here the entries of Rainy and Winter are the same, so the Gini index is also same. And it is:
Gini index = 1 – ((1/2)2 + (1/2)2)
= 1 – (0.25 + 0.25)
= 1 – 0.5
= 0.5

10. From the below table where the target is to predict play or not (Yes or No) based on weather condition, what is the Gini index for the Temperature feature?

Day Climate Temperature Wind Decision
1 Sunny Medium Strong No
2 Sunny Hot Weak Yes
3 Rainy Medium Weak Yes
4 Winter Cool Weak Yes
5 Rainy Cool Strong No
6 Winter Cool Strong No
7 Sunny Hot Strong No

a) 0.43
b) 0.45
c) 0.48
d) 0.5
View Answer

Answer: c
Explanation: From the table we have:

Climate Yes No Instances
Hot 1 1 2
Cool 1 2 3
Medium 1 1 2

We know the Gini index for the Temperature feature is the weighted sum of Gini index for Temperature features.
Gini index = 1 – ∑\(_{i=1} ^{n}\)p\(_{i} ^{2}\)
Gini index (Temperature = Hot) = 1 – ((1/2)2 + (1/2)2)
= 1 – (0.25 + 0.25)
= 0.5
Gini index (Temperature = Cool) = 1 – ((1/3)2 + (2/3)2)
= 1 – (0.11 + 0.44)
= 0.45
Gini index (Temperature = Medium) = 1 – ((1/2)2 + (1/2)2)
= 1 – (0.25 + 0.25)
= 0.5
Gini index (Temperature) = (2/7) * 0.5 + (3/7) * 0.45 + (2/7) * 0.5
= 0.29 * 0.5 + 0.43 * 0.45 + 0.29 * 0.5
= 0.145 + 0.194 + 0.145
= 0.48

11. From the below table where the target is to predict play or not (Yes or No) based on weather conditions, what is the Gini index for the Wind feature?

Day Climate Temperature Wind Decision
1 Sunny Medium Strong Yes
2 Sunny Hot Weak Yes
3 Rainy Medium Weak Yes
4 Winter Cool Weak No
5 Rainy Cool Strong No
6 Winter Cool Strong No
7 Sunny Hot Strong No

a) 0.41
b) 0.43
c) 0.45
d) 0.47
View Answer

Answer: a
Explanation: We know the Gini index for the Wind feature is the weighted sum of Gini index for Wind features. From the table we have:

Wind Yes No Instances
Strong 1 3 4
Weak 2 1 3

Gini index = 1 – ∑\(_{i=1} ^{n}\)p\(_{i} ^{2}\)
Gini index (Wind = Strong) = 1 – ((1/4)2 + (3/4)2)
= 1 – (0.0625 + 0.5625)
= 1 – 0.625
= 0.38
Gini index (Wind = Weak) =1 – ((2/3)2 + (1/3)2)
= 1 – (0.44 + 0.11)
= 1 – 0.55
= 0.45
Gini index (Wind) = (4/7) * 0.38 + (3/7) * 0.45
= 0.57 * 0.38 + 0.43 * 0.45
= 0.217 + 0.194
= 0.41

Sanfoundry Global Education & Learning Series – Machine Learning.

To practice all areas of Machine Learning, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.