What happens if at leaf node both classes have same number of samples?
This is an implementation detail, and I wouldn't necessarily rely on this behavior, but presently in sklearn, it will choose the &quot;first&quot; class.
The predict method calls for the probability prediction, then takes the argmax, which in case of ties takes the first one:
https://github.com/scikit-learn/scikit-learn/blob/fd237278e/sklearn/tree/_classes.py#L403
https://numpy.org/doc/stable/reference/generated/numpy.argmax.html