• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 40 pages
Class notes

CS-7641-Machine-Learning-Notes-Midterm

Document preview thumbnail
Preview 4 out of 40 pages

CS-7641-Machine-Learning-Notes-Midterm

Content preview

CS7641 SL01: Decision Trees Mohamed Ameen Amer




SL00: Supervised Learning
• Supervised learning → Function approximation.
• Unsupervised learning → Function description.
• Reinforcement learning → Learning from delayed reward.
• Algorithms and data are co-equal.
In a supervised learning setting, the learning algorithm will be provided with instances and labels as
training data.
• Induction: Going from specifics to generalities.
• Classification: The classification task can be summarized as taking input 𝑥 (e.g. images of traffic
signs) and assign it to a label 𝑦 that belongs to a discrete number of labels 𝑌 (e.g. STOP, Speed Limit,
Keep Right, etc.).
• Regression: The regression task can be summarized as taking input 𝑥 (e.g. employee’s years of
experience) and mapping it to a real continuous value (e.g. expected salary).


Terminology:
• Instances: Inputs (Features).
• Concept: A set of functions that make good candidates to map inputs to outputs.
• Target concept: The actual function that can map inputs to outputs. In other words, the concept that
we’re willing to model.
• Hypothesis class: A subset of the concept set of functions that is easier to search through for the
target concept.
• Sample (Training set): A set of instances with correct labels.
• Candidate: The best approximation of the target concept.
• Testing set: A set of instances with correct labels that was not visible to the learning algorithm
during the training phase. It’s used to determine the algorithm performance on novel data.




SL01: Decision Trees:
A sequence of decision making points (nodes) applied to every instance to assign it to a specific class.
Example: Classifying vehicles into Sedans and Trucks.


Representation vs Algorithm:
• A decision tree is a structure of nodes, edges and leaves that can be used to represent the data.
1. Nodes represent attributes (vehicle length, vehicle height, number of doors, etc.).
2. Edges represent values. (A specific value for each attribute)
3. Leaves represent the output (vehicle’s type).

Page | 1

,CS7641 SL01: Decision Trees Mohamed Ameen Amer


• A decision tree algorithm is a sequence of steps that will lead you to the desired output.
1. Pick the best attribute (the one that can split the data roughly in half).
- If this attribute added no valuable information (not a good split), it might cause overfitting.
2. Ask a question about this attribute.
3. Follow the correct answer path.
4. Loop back to (1) till you narrow down the possibilities to one answer (the output).
Note that the usefulness of a question depends upon the answers we got to previous questions.


Appropriate Problems for Decision Trees:
• Instances are represented by attribute-value pairs.
• The target function has discrete output values.
• Disjunctive descriptions maybe required.
• The training data may contain errors.
• The training data may contain missing attribute values.


Expressiveness:
• Decision trees can basically express any function using the input attributes.
• For Boolean functions (AND, OR, etc.), the truth table row will be translated into a path to a leaf.
𝑛
• Decision tree hypothesis space is very huge (2(2 ) ), this why we need to design algorithms to
efficiently search the hypothesis space for the best decision tree.


ID3 Algorithm:
• ID3 builds decision trees using a top-down, greedy approach.
• Pseudocode:
1. Pick the best attribute 𝐴.
- To select this attribute, a statistical test is used to determine for each attribute how well it
alone classifies the training examples.
2. Split the data into subsets that correspond to the possible values of the best attribute.
3. Assign 𝐴 as a decision attribute for a node.
4. For each value of 𝐴, create a descendent node.
5. Sort training examples to leaves.
6. If (examples perfectly classified) {
Stop
} else {
Iterate over leaves
}




Page | 2

,CS7641 SL01: Decision Trees Mohamed Ameen Amer


• Finding the best attribute:
We can find the best attribute by calculating the information gain of each particular attribute, which
is the amount of information gained by picking this attribute.
Mathematically, the information gain expresses how well an attribute splits the data into groups
based on classification. It quantifies the reduction in randomness (Entropy) over the labels we have
with a set of data, based upon knowing the value of a particular attribute.
|𝑆𝑣 |
𝐺𝑎𝑖𝑛(𝑆, 𝐴) = 𝐸𝑛𝑡𝑟𝑜𝑝𝑦(𝑆) − ∑ 𝐸𝑛𝑡𝑟𝑜𝑝𝑦(𝑆𝑣 )
|𝑆|
𝑣
- 𝑆 is the set of training examples.
- 𝐴 is an attribute.
- 𝑣 is possible values for the attribute.
- 𝐸𝑛𝑡𝑟𝑜𝑝𝑦(𝑆) quantifies the impurity in 𝑆:
𝐸𝑛𝑡𝑟𝑜𝑝𝑦(𝑆) = − ∑ 𝑃𝑟 (𝑣) log 𝑃𝑟 (𝑣)
𝑣
The Entropy can be as large as log 𝑣
- 𝑃𝑟 (𝑣) is the probability of seeing the value 𝑣.
So ID3 is an algorithm of maximizing over the information gain (minimizing Entropy).
• ID3 hypothesis space:
- Hypothesis space is complete: The target function is surely in this hypothesis space.
- ID3 always maintains (outputs) a single hypothesis: As a result, it cannot determine how many
alternative decision trees are consistent with the training data.
- No backtracking: Once ID3 selects an attribute to test at a particular level in the tree, it never
backtracks to reconsider this choice. This puts ID3 under the risk of converging to a local minima
(A solution that is not globally optimum).
- ID3 considers all the training data at each step (when calculating the Information Gain), this
makes it robust to individual noisy examples.
• ID3 Bias:
We have two kind of biases:
1. Restriction Bias: Describes the hypothesis set space 𝐻 that we will consider for learning.
- Complete hypothesis space (low Restriction Bias).
2. Preference Bias: Describes the subset of hypothesis 𝑛, from the hypothesis set space 𝐻 (𝑛 ∈ 𝐻),
that we prefer.
→ Good splits near the top of the tree (attributes with the highest Information Gain are closer
to the root).
→ Trees that gives the correct answers.
→ Prefers shorter trees vs. longer trees, which is a natural result of preferring good splits near
the top.




Page | 3

, CS7641 SL01: Decision Trees Mohamed Ameen Amer


• We say that ID3 uses a greedy approach because it will decide which attribute should be at the root
of the tree by looking just one move ahead. It compares all available attributes to find which one
classifies the data the best, but it doesn’t look ahead (or behind) at other attributes to see which
combinations of them classify the data the best. This means that while the algorithm will, in most
cases, come up with a good decision tree, a better one may exist.
• ID3 algorithm returns an optimal decision tree, but as the size of the training data and the number
of attributes increase, it becomes more likely that running ID3 on it will return a suboptimal decision
tree.


Other considerations:
• What if we have continuous attributes?
- Information gain for a continuous attribute would be the full entropy of 𝑆. This is because there
is only one observation per attribute value. For each value of the attribute, the training data
agrees unanimously on a classification and the entropy for each attribute value is 0.
- To solve this issue, we split the attribute range into equal intervals.
- A modified ID3 can be used to find the best split.
• Does it make sense to repeat an attribute along a path in the tree?
- No if this attribute has a finite value.
- Continuous attributes can be tested with different questions.
• When do we stop?
- When everything is classified correctly.
- No more attributes.
- When you have noise, don’t overfit:
→ Not too big tree.
→ We can use cross-validation to prevent overfitting.
→ Use a validation set and stop when the error is low enough.
→ Build the whole tree, the prune it. Pruning means removing sections of the tree that provide
little power in classifying instances.
• What if it’s a regression problem?
- Information Gain won’t be efficient because it’s not clear how to measure information over
continuous values.
- We can measure variance, which is the deviation of a variable from its mean value.
- We need to decide what to report on the leaves (output). Average might be an option.




Page | 4

Document information

Uploaded on
November 9, 2026
Number of pages
40
Written in
2026/2027
Type
Class notes
Professor(s)
Cs-7641-machine-learning-notes-midterm
Contains
All classes
$36.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ScholarDocsUS
4.4
(311)
Sold
283
Followers
1
Items
1279
Last sold
3 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions