0% found this document useful (0 votes)
18 views

P02 DecisionTrees

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

P02 DecisionTrees

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Aprendizagem 2023

Lab 2: Decision Trees

Practical exercises

1. Consider the following dataset: 𝑦1 𝑦2 𝑦3 class


𝐱1 a a a +
𝐱2 c b c +
𝐱3 c a c +
𝐱4 b a a ─
𝐱5 a b c ─
𝐱6 b b c ─

Plot the learned decision tree using information gain (Shannon entropy). Show your calculus.

2. Show if a decision tree can learn the following logical functions and, if so, plot the corresponding
decision boundaries.
a) AND
b) OR
c) XOR

3. Consider the following testing targets, 𝒛, and the corresponding predictions, 𝒛̂, by a decision tree:

𝒛 = [𝐴 𝐴 𝐴 𝐵 𝐵 𝐵 𝐶 𝐶 𝐶 𝐶]
𝒛̂ = [𝐵 𝐵 𝐴 𝐶 𝐵 𝐴 𝐶 𝐴 𝐵 𝐶]
a) Draw the confusion matrix
b) Compute the accuracy and sensitivity per class
c) Considering class 𝐶, identify its precision and 𝐹1 -measure
d) Identify the accuracy, sensitivity, and precision of a random classifier

4. Consider a dataset composed by 374 records,


described by 6 variables, and classified according
to the following decision tree. Each leaf in the
tree shows the label, number of classified records
with the label, and total number of observations
in the leaf. The positive class is the minority class.
a) Compute the confusion matrix.
b) Compare the accuracy of the given tree versus
a pruned tree with only two nodes.
Is there any evidence towards overfitting?
c) [optional] Are decision trees learned from high-dimensional data susceptible to underfitting?
Why an ensemble of decision trees minimizes this problem?
Programming quests
5. Following the provided Jupyter notebook on Classification, learn and evaluate a decision tree
classifier on the breast.w.arff dataset (available at the webpage) using sklearn.

Considering a 80-20 train-test split:


a) visualize the decision tree learned from the training observations with default parameters
b) compare the train and test accuracy of decision trees with a maximum depth in {1, 2, 3}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy