Decision tree classification on Mushroom data I have been going through notebooks available online where classification of mushrooms are done to poisonous(p) or edible(e) based on mushroom properties. The features present in the dataset are all categorical in nature. Have a look below to the sample data:
class   cap-shape   cap-surface cap-color   bruises odor    gill-attachment gill-spacing    gill-size   gill-color  ... stalk-surface-below-ring    stalk-color-above-ring  stalk-color-below-ring  veil-type   veil-color  ring-number ring-type   spore-print-color   population  habitat
0   p   x   s   n   t   p   f   c   n   k   ... s   w   w   p   w   o   p   k   s   u
1   e   x   s   y   t   a   f   c   b   k   ... s   w   w   p   w   o   p   n   n   g
2   e   b   s   w   t   l   f   c   b   n   ... s   w   w   p   w   o   p   n   n   m
3   p   x   y   w   t   p   f   c   n   n   ... s   w   w   p   w   o   p   k   s   u
4   e   x   s   g   f   n   f   w   b   k   ... s   w   w   p   w   o   e   n   a   g

I see the solutions available use LabelEncoder from scikit-learn to change this categorical properties to integers and then use them to DecisionTreeClassifier. While the accuracy after training has been quite good, what I don't get is the logic behind the classifier's split - since they are categorical in nature.
(Q1) Because, consider a split cap-color < yellow, does this make any sense? So is this approach fundamentally wrong?
(Q2) I can understand, we can change the categorical values to one-hot-encoded vectors and then train the DT classifier. Now if this classifier is providing you lesser accuracy, which one would one use in real-life?
One of the notebooks: here

You can certainly transform categorical labels to numbers and (mis-)treat them as you described.
The magic lies within the configuration of the algorithm.
Lets have a look at DecisionTreeClassifer by sklearn which you mentioned reaching good results.
There are two criteria that enable a DecisionTree to still perform well even in the described setup, namely

max_depth int, default=None
The maximum depth of the tree. If None, then nodes are expanded until all leaves are pure or until all leaves contain less than min_samples_split samples.

and

max_leaf_nodes int, default=None
Grow a tree with max_leaf_nodes in best-first fashion. Best nodes are defined as relative reduction in impurity. If None then unlimited number of leaf nodes.

Given that both are by default of value None which is interpreted as unlimited, it allows the tree to split nodes until all leafs are pure.
Thus (A1) the split in so far makes sense as using numerical values enables you to use the existing sklearn implementation of the DecisionTree. It does not make much sense mathematically / or within reason of the domain, but it is an easy hack to get going.
