This is my code
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
dataset = load_iris()
X_train,X_test,y_train,y_test = train_test_split(dataset.data,dataset.target,test_size=0.3)
reg = DecisionTreeClassifier(max_depth=1)
reg.fit(X_train,y_train)
print(reg.predict(X_test))
I have added the image of tree for trained set, here you can see on false case the dataset has values of [0,39,38]
which points to the output of 0,1,2 respectively. So from false dataset 1 has highest possibility to become an output. Decision tree should classify either 0 or 1 as per the tree but I can see 2 also in the prediction. So, How sklearn choose the class on false set under what condition to predict the output.