Decision Trees
Machine Learning
Tree Based Methods in Machine Learning
Interview questions on Tree Based Methods in Machine Learning.
91 questions
Decision Trees
Q2. What is the purpose of decision trees in machine learning?
Decision Trees
Q3. How is a decision tree built?
Decision Trees
Q4. What is over-fitting in decision trees, and how can it be prevented?
Decision Trees
Q5. What are some common impurity measures used in decision tree algorithms?
Decision Trees
Q6. List down pros and cons of different splitting criteria?
Decision Trees
Q7. What is pruning in decision trees?
Decision Trees
Q8. Can decision trees handle categorical data, and how is it done?
Decision Trees
Q9. What are some advantages of decision trees in machine learning?
Decision Trees
Q10. What are some limitations of decision trees?
Decision Trees
Q11. What is ID3, and how does it work?
Decision Trees
Q12. What is information gain in ID3?
Decision Trees
Q13. What are the steps involved in building a decision tree with ID3?
Decision Trees
Q14. What are the limitations of ID3?
Decision Trees
Q15. How does ID3 handle over-fitting?
Decision Trees
Q16. What is the difference between ID3 and C4.5?
Decision Trees
Q17. Can you explain how the concept of entropy is used in ID3?
Decision Trees
Q18. What are different criteria along which the implementation of DTs varies?
Decision Trees
Q19. What is the difference between CART and ID3/C4.5?
Decision Trees
Q20. How does CART handle over-fitting?
Ensemble Learning
Q21. Mark all the approaches which can be utilized to boost a single model performance:
- Majority Voting
- Using K-identical base-learning algorithms
- Using K-different base-learning algorithms
- Using K-different data-folds
- Using K-different random number seeds
- A combination of all the above approaches
Ensemble Learning
Q22. What are the key components of a stacking ensemble?
Ensemble Learning
Q23. How do you prevent over-fitting in a stacked ensemble?
Ensemble Learning
Q24. Can you explain the process of creating a stacking ensemble?
Ensemble Learning
Q25. What is the advantage of stacking over using a single powerful model?
Ensemble Learning
Q26. What are some popular algorithms used as base models in stacking ensembles?
Ensemble Learning
Q27. When should you consider using stacking in a machine learning project?
Ensemble Learning
Q28. How does blending work?
Ensemble Learning
Q29. Can you explain the difference between stacking and blending?
Ensemble Learning
Q30. What is the purpose of a meta-model in blending?
Ensemble Learning
Q31. What are the advantages of blending?
Ensemble Learning
Q32. What are the common algorithms used for blending?
Ensemble Learning
Q33. What precautions should you take when implementing blending?
Ensemble Learning
Q34. Can you explain the difference between bagging, boosting, and blending?
Ensemble Learning
Q35. When should you consider using blending in a machine learning project?
Ensemble Learning
Q36. What challenges can arise when implementing blending in practice?
Ensemble Learning
Q37. An argument erupts between two senior data-scientists regarding the choice of an approach for training of a very small medical corpus. One suggest that bagging is superior while the other suggests stacking. Which technique, bagging or stacking, in your opinion is superior? Explain in detail.
- Stacking since each classier is trained on all of the available data.
- Bagging since we can combine as many classifiers as we want by training each on a different sub-set of the training corpus.
Ensemble Learning
Q38. Below Fig depicts a part of a specific ensembling approach applied to the models $x1, x2...xk$.
In your opinion, which approach is being utilized?
Ensemble Learning
Q39. 1. **True or false**: Training an ensemble of a single monolithic architecture results in lower model diversity and possibly decreased model prediction accuracy.
- True or false: The generalization accuracy of an ensemble increases with the number of well-trained models it consists of.
- True or false: Bootstrap aggregation (or bagging), refers to a process wherein a CNN ensemble is being trained using a random subset of the training corpus.
- True or false: Bagging assumes that if the single predictor shave independent errors, then a majority vote of their outputs should be better than the individual predictions.
Ensemble Learning
Q40. 1. In a transfer-learning experiment conducted by a researcher, a number of ImageNet-pretrained CNN classifiers, selected from Table 6.1 are trained on five different folds drawn from the same corpus. Their outputs are fused together producing a composite machine. Ensembles of these convolutional neural networks architectures have been extensively studies an evaluated in various ensembling approaches. Is it likely that the composite machine will produce a prediction with higher accuracy than that of any individual classifier? Explain why.
Ensemble Learning
Q41. In committee machines, mark all the combiners that do not make direct use of the input:
- A mixture of experts
- Bagging
- Ensemble averaging
- Boosting
Ensemble Learning
Q42. Refer to the papers: <a href='https://arxiv.org/pdf/1506.02142.pdf'>Dropout as a Bayesian Approximation</a> and <a href='https://arxiv.org/pdf/1906.02530.pdf'>Can You TrustYour Model’s Uncertainty?</a> and answer the following question:
- Do deep ensembles achieve a better performance on out-of-distribution uncertainty benchmarks compared with Monte-Carlo (MC)-dropout?
Ensemble Learning
Q43. **True or False**: Considering a binary classification problem $(y = 0\ or \ y = 1)$, ensemble averaging, wherein the outputs of individual models are linearly combined to produce a fused output is a form of a static committee machine.
Ensemble Learning
Q44. **True or false**: When using a single model, the risk of overfitting the data increases when
the number of adjustable parameters is large compared to cardinality (i.e., size of the set) of the training corpus.
Ensemble Learning
Q45. **True or false**: If we have a committee of $K$ trained models and the errors are uncorrelated, then by averaging them the average error of a model is reduced by a factor of $K$.
Ensemble Learning
Q46. 1. Define ensemble learning in the context of machine learning.
- Provide examples of ensemble methods in classical machine-learning.
- True or false: Ensemble methods usually have stronger generalization ability.
- Complete the sentence: Bagging is
variance/biasreduction scheme while boosting reducedvariance/bias.
Ensemble Learning
Q47. Your colleague, a well-known expert in ensembling methods, writes the following pseudo-code in Python shown in Fig. 6.7 for the training of a neural network. This runs inside a standard loop in each training and validation step.
import torchvision.models as models ...
models = ['resnext']
for m in models:
train ...
compute VAL loss ...
amend LR ...
if (val_acc > 90.0):
saveModel()
- What type of ensembling can be used with this approach? Explain in detail.
- What is the main advantage of snapshot ensembling? What are the disadvantages, if any?
Ensemble Learning
Q48. Assume further that your colleague amends the code as follows.
import torchvision.models as models
import random
import np
...
models = ['resnext']
for m in models:
train ...
compute loss ...
amend LR ...
manualSeed= draw a new random number
random.seed(manualSeed)
np.random.seed(manualSeed)
torch.manual_seed(manualSeed)
if (val_acc > 90.0):
saveModel()
Explain in detail what would be the possible effects of adding lines 10-13.
Ensemble Learning
Q49. 1. Assume your colleague, a veteran in DL and an expert in ensembling methods writes the following Pseudo code shown in Fig. 6.9 for the training of several neural networks. This code snippet is executed inside a standard loop in each and every training/validation epoch.
import torchvision.models as models
...
models = ['resnext','vgg','dense']
for m in models:
train ...
compute loss/acc
...
if (val_acc > 90.0):
saveModel()
```
What type of ensembling is being utilized in this approach? Explain in detail.
2. Name one method by which NN models may be combined to yield a single prediction.
Ensemble Learning
Q50. 1. Referring to Below fig. which depicts a specific learning rate schedule, describe the basic notion behind its mechanism.
Ensemble Learning
Q51. Two popular algorithms for winning Kaggle solutions are Light GBM and XGBoost. They are both gradient boosting algorithms.
- What is gradient boosting?
- What problems is gradient boosting good for?
Random Forest
Q52. Complete the sentence: A random forest is a type of a decision tree which utilizes `[bagging/boosting]`
Random Forest
Q53. The algorithm depicted in Fig. 6.1 was found in an old book about ensembling. Name the
algorithm.
Algorithm 1: Algo 1
Data: A set of training data, Q with N elements has been established while K times do Create a random subset of N ′ data by sampling from Q containing the N samples; N′ < N; Execute algorithm Algo 2; Return all N′ back to Q
Algorithm 2: Algo 2
Choose a learner ; while K times do Pick a training set and train with ;
Random Forest
Q54. What is a Random Forest, and how does it work?
Random Forest
Q55. How do you choose between different types of decision tree algorithms (e.g., CART, ID3, C4.5, Random Forest)?
Random Forest
Q56. What is the difference between a decision tree and a Random Forest?
Random Forest
Q57. Why is it called a "Random" Forest?
Random Forest
Q58. What is the purpose of feature bagging in a Random Forest?
Random Forest
Q59. How does a Random Forest handle missing data?
Random Forest
Q60. What are the advantages of using Random Forests?
Random Forest
Q61. What is out-of-bag error, and how is it used in Random Forests?
Random Forest
Q62. What is the issue with Gini impurity?
Random Forest
Q63. Can you explain the concept of feature importance in a Random Forest?
Random Forest
Q64. What are some potential drawbacks of using Random Forests?
Random Forest
Q65. When would you choose a Random Forest over other machine learning algorithms?
Random Forest
Q66. Consider training corpus consisting of balls which are glued together as triangles, each
of which has either .
- We draw several samples from this corpus as presented in Fig.6.3 where in each sample is equiprobable. What type of sampling approach is being utilized here?
- Two samples are drawn one after the other. In which of the following cases is the covariance between the two samples equals zero? - (i) Sampling without replacement - (ii) Sampling with replacement
- During training, the corpus sampled with replacement and is divided into several folds as presented in Fig. 6.4.
Random Forest
Q67. There are several methods by which the outputs of base classifiers can be combined to yield a single prediction. Below code snippet depicts part of a specific ensembling approach applied to several CNN model predictions for a labelled data-set. Which approach is being utilized?
- Majority voting for binary classification
- Weighted majority voting for binary classification
- Majority voting for class probabilities (iv) Weighted majority class probabilities
- An algebraic weighted average for class probabilities
- An adaptive weighted majority voting for combining multiple classifiers
l=[]
for i,f in enumerate(filelist):
temp = pd.read_csv(f)
l.append(temp)
arr = np.stack(l,axis=-1)
avg_results = pd.DataFrame(arr[:,:-1,:].mean(axis=2))
avg_results['image'] = l[0]['image']
avg_results.columns = l[0].columns
Random Forest
Q68. **True or False**: A perfect ensemble comprises of highly correct classifiers that differ as much as possible.
Boosting based Algorithms
Q69. How does bagging work?
Boosting based Algorithms
Q70. What are the advantages of bagging over decision trees?
Boosting based Algorithms
Q71. How does bagging reduces the variance in decision trees?
Boosting based Algorithms
Q72. What are some popular algorithms that use bagging?
Boosting based Algorithms
Q73. What's the difference between bagging and boosting?
Boosting based Algorithms
Q74. How does bagging handle imbalanced datasets?
Boosting based Algorithms
Q75. Can bagging be used with any base model?
Boosting based Algorithms
Q76. What are some potential drawbacks of bagging?
Boosting based Algorithms
Q77. What is the trade-off between bagging and variance?
Boosting based Algorithms
Q78. **True or false**: In bagging, we re-sample the training corpus with replacement and there-
fore this may lead to some instances being represented numerous times while other instances not to be represented at all.
Boosting based Algorithms
Q79. Bagging and boosting are two popular ensembling methods. Random forest is a bagging example while XGBoost is a boosting example.
- What are some of the fundamental differences between bagging and boosting algorithms?
- How are they used in deep learning?
Boosting based Algorithms
Q80. How does boosting work?
Boosting based Algorithms
Q81. What are some popular boosting algorithms?
Boosting based Algorithms
Q82. What is the key idea behind AdaBoost?
Boosting based Algorithms
Q83. What is overfitting, and how does boosting address it?
Boosting based Algorithms
Q84. Can boosting models handle noisy data?
Boosting based Algorithms
Q85. What are the hyperparameters in boosting algorithms?
Boosting based Algorithms
Q86. What is the key idea behind XGBoost?
Boosting based Algorithms
Q87. What are some advantages of using XGBoost?
Boosting based Algorithms
Q88. How does LightGBM differ from traditional gradient boosting algorithms?
Boosting based Algorithms
Q89. What is the trade-off between LightGBM's speed and memory consumption?
Boosting based Algorithms
Q90. How does CatBoost handle categorical features?
Boosting based Algorithms