Machine Learning Algorithm Quizzes
Decision Tree
Question 1
Which line of code correctly imports the Decision Tree model for a classification task from scikit-learn?
Question 2
A Decision Tree that is allowed to grow to its maximum depth without any constraints is highly prone to __ the training data.
Your answer here.Question 3
Select all the common hyperparameters in scikit-learn's DecisionTreeClassifier used to control the tree's complexity and prevent overfitting:
Question 4
In a DecisionTreeClassifier, what does the criterion hyperparameter (e.g., 'gini' or 'entropy') define?
Question 5
What is a major advantage of a single Decision Tree model compared to models like Logistic Regression or SVMs?
Question 6
While DecisionTreeClassifier is used for classification, the scikit-learn class used for regression tasks with a decision tree is called DecisionTree__________.
Question 7
What is the impact of feature scaling (e.g., using StandardScaler or MinMaxScaler) on a single Decision Tree's performance?
Question 8
After fitting a DecisionTreeClassifier as model, how can you retrieve the importance of each feature in making splits?
Question 9
Which of the following statements about Decision Trees are true?
End of Quiz
Your final score is: 0 / 0
List of Questions
Question 1: Which line of code correctly imports the Decision Tree model for a classification task from scikit-learn?
Answers: from sklearn.tree import DecisionTreeClassifier.
Question 2: Select all the common hyperparameters in scikit-learn's `DecisionTreeClassifier` used to control the tree's complexity and prevent overfitting:
Answers: max_depth, min_samples_leaf, min_samples_split.
Question 3: In a `DecisionTreeClassifier`, what does the `criterion` hyperparameter (e.g., 'gini' or 'entropy') define?
Answers: The function to measure the quality of a split..
Question 4: What is a major advantage of a single Decision Tree model compared to models like Logistic Regression or SVMs?
Answers: It is highly interpretable and can be easily visualized..
Question 5: What is the impact of feature scaling (e.g., using `StandardScaler` or `MinMaxScaler`) on a single Decision Tree's performance?
Answers: It has little to no effect on model performance..
Question 6: After fitting a `DecisionTreeClassifier` as `model`, how can you retrieve the importance of each feature in making splits?
Answers: model.feature_importances_.
Question 7: Which of the following statements about Decision Trees are true?
Answers: The model's predictions are based on a series of if-then-else rules., They are non-parametric models, meaning they don't make strong assumptions about the underlying data distribution., A small change in the training data can sometimes lead to a completely different tree structure..