Complete the code to import the DecisionTreeClassifier from scikit-learn.
from sklearn.tree import [1]
The DecisionTreeClassifier is the class used to create decision tree models for classification tasks in scikit-learn.
Complete the code to create a decision tree classifier object with a maximum depth of 3.
model = DecisionTreeClassifier([1]=3)
min_samples_split instead of max_depth.random_state with depth.The max_depth parameter limits the depth of the tree to prevent overfitting.
Fix the error in the code to train the decision tree model on features X and labels y.
model.fit([1], y)y as the first argument.The fit method requires the feature data as the first argument and the labels as the second.
Fill both blanks to predict labels for test data and store the predictions in variable 'predictions'.
predictions = model.[1]([2])
fit instead of predict.y_test instead of features.The predict method is used to get predictions from the model using test features X_test.
Fill all three blanks to calculate and print the accuracy score of the model predictions.
from sklearn.metrics import {{BLANK_1 }} accuracy = [2](y_test, {{BLANK_3}}) print(f"Accuracy: {accuracy:.2f}")
y_train instead of test labels.The accuracy_score function compares true labels y_test with predicted labels predictions to compute accuracy.
