Question 27
For the following block of code, we get the output as 0.9875. How would the output change if we decrease max depth value ?:
from sklearn.datasets import load_winefrom sklearn.tree import DecisionTreeClassifierfrom sklearn.model_selection import train_test_splitX,y = load_wine(as_frame = True, return_X_y = True)
X_train,X_test,y_train,y_test = train_test_split(X, y, test_size = 0.10, random_state = 12)
clf = DecisionTreeClassifier(max_depth = 6, min_samples_split = 2, min_samples_leaf=3, random_state = 81)
clf.fit(X_train, y_train)print(clf.score(X_train, y_train))Output score will definitely increase.
Output score will definitely decrease.
Output score may decrease or remain the same.
Code will throw an error because max_depth can’t be less than 6.