Docsity

Decision Trees in Machine Learning: Classification with an Example.., Exams of Advanced Education

Toggle sidebar
bg1
1 | P a g e
Decision Trees in Machine Learning:
Classification with an Example..
What are decision trees? - ANSWERmachine learning algorithm used for
classification and regression. It learns by asking a series of "if-else" questions
in specific order.
Structure of nodes, edges, and leaves that can be used to represent data.
Nodes represent attributes
edges represent values
leaves represent outputs
What is the algorithm for decision tree - ANSWER1. pick the best attribute (
that splits data in half) - if the attribute no valuable information it might be
due to overfitting
2. Ask a question about this attribute
3. Follow the correct path
4. Loop back to 1 until you get the ANSWER
Decision Tree hypothesis space is very huge- - ANSWER2 ^ (2^n) this is why
we need to design algorithms to efficiently search the hypothesis space for
the best decision tree
pf3
pf4
pf5
pf8

Partial preview of the text

Download Decision Trees in Machine Learning: Classification with an Example.. and more Exams Advanced Education in PDF only on Docsity!

Decision Trees in Machine Learning:

Classification with an Example..

What are decision trees? - ANSWERmachine learning algorithm used for classification and regression. It learns by asking a series of "if-else" questions in specific order. Structure of nodes, edges, and leaves that can be used to represent data. Nodes represent attributes edges represent values leaves represent outputs What is the algorithm for decision tree - ANSWER1. pick the best attribute ( that splits data in half) - if the attribute no valuable information it might be due to overfitting

  1. Ask a question about this attribute
  2. Follow the correct path
  3. Loop back to 1 until you get the ANSWER Decision Tree hypothesis space is very huge- - ANSWER2 ^ (2^n) this is why we need to design algorithms to efficiently search the hypothesis space for the best decision tree

What is the ID3 Algorithm - ANSWER- ID3 builds the decision tree using a top- down greedy approach greedy - because it will decide which attribute should be at the root by just looking at the next move. Doesn't not look at the entire input space Maximizes information gain (minimizing entropy) Algo:

  1. Pick best attribute A
  2. split dataset into subsets
  3. assigns A as a decision attribute for a node
  4. For each value of A, create a descendent of node
  5. Sort training samples to leaves
  6. If examples are perfectly classified : STOP
  7. Else iterate over leaves How do you find the BEST attributes in a Decision Tree - ANSWER- using information gain : calculate infromation gain of each attribute, what is information gain - ANSWERthe amount of information gained by picking this attribute. how well an attribute splits the data into groups What is entropy - ANSWERA measure of disorder or randomness.

What should you do to prevent overfitting - ANSWER- use cross validation and pruning What is pruning - ANSWERmeans to remove sections of the tree that provide litter to no information What if it's a regression problem - ANSWERinformation gain woun't be sufficient, we can can measure variance instead. Which is the deviation of a variable from its mean value The leaf of outputs should be - ANSWERmean or average Decision tree complexity - ANSWERrun time to construct a balance binary tree is O(mnlogn) n is samples m is features Query time is - ANSWERO(log n) n number of samples What are some the advantages of using DT - ANSWER- simple to understand and interpret

  • require little data preparation. Other algorithms require normalization, etc
  • cost of using tree is logarithmic
  • able to handle numerical and categorical data
  • uses a white box model - easier for humans to interpret

Limitations of DTs - ANSWER- can create over-complex trees that don't generalize well (overfitting) --- can be reduced by pruning or setting minimum numbers of samples required at a leaf node or setting maximum tree depth

  • small variations in data can generate completely different trees
  • learning optimal decision tree is NP hard problem
  • can be biased for classes that dominate is it possible to construct a decision tree 100 % accuracy on validation set - ANSWERyes as long no 2+ features have the same classes How is a decision tree pruned? - ANSWERremoving branches that have weak predictive power in order to reduce model complexity and increase predictive accuracy can happen bottom up or top down
  • reduce each node, if it doesn't decrease accuracy, keep it pruned What is the time complexity for training and predicting for DT? - ANSWERtraining O (n^2 p) predicting O(p) If decision tree classifier has 100% accuracy on training data. Will logistic regression also have same 100% accuracy - ANSWER- no. DTs can learn complex surfaces(like XOR). Logistic regression can only learn linear classification boundaries
  • use different initialization and train network several times. Use the average of predictions from all nets to predict test data An infinite depth decision tree can always archieve 100% provided that - ANSWERthere is no mislabeled in training set If tree is getting bad performance for both training and testing it could be that - ANSWER-decision tree is too shallow (small depth) For neural networks, its typical to train k networks and average the results. Why not run your decision tree (using all data) k times and average the results - ANSWERbecause DTs return the same results each time you run them What strategies can help reduce overfitting in decision trees? - ANSWER- pruning
  • enforcing minimum number of samples in leaf nodes
  • enforcing a maximum depth Can DT have 0 training error in linearly seperate training dataset - ANSWERyes Pruning a decision tree to a certain depth increases bias and decreases variance - ANSWERTrue

Given infinite training data over a Boolean atttributes, we can always learn the target concept using a decision tree - ANSWERTrue a tree with depth n can represent any boolean function perfectly Reduced error pruning decreases - ANSWERthe number of nodes(namlely parameters) in the decision tree and thus yields simple models having higher bias and lower variance Entropy is not better than Gini Impurity or the other way around. Explain - ANSWEROne algorithm is not better than the other at generalizing accuracy. You have to test it and see, it all depends on your dataset. No free lunch theorem states that no algorithm/impurity will dominate all others Decision trees prefer correct trees with fewer nodes and therefore making it simpler - ANSWERtrue