Question 22
Which of the following is the most expected output for the code given below:
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)
clf1 = DecisionTreeClassifier(ccp_alpha = 0.1, random_state = 81)
clf2 = DecisionTreeClassifier(ccp_alpha = 0.25, random_state = 81)
clf1.fit(X_train, y_train)clf2.fit(X_train, y_train)
print(clf1.score(X_train, y_train))print(clf2.score(X_train, y_train))print(clf1.get_depth())print(clf2.get_depth())0.9875
0.9125
2
30.9125
0.9875
2
30.9875
0.9125
3
20.9125
0.9875
3
2