Some implementations of decision trees (eg cran/tree) can split on categorical variables where the split separates the variable into 2 groups:
> library("tree")
> df <- read.csv('https://forge.scilab.org/index.php/p/rdataset/source/file/master/csv/datasets/Titanic.csv')
> tree(Survived ~ Class, data=df, weights=Freq, minsize=10)
node), split, n, deviance, yval, (yprob)
* denotes terminal node
1) root 2201 2769 No ( 0.6770 0.3230 )
2) Class: 3rd,Crew 1591 1772 No ( 0.7549 0.2451 ) *
3) Class: 1st,2nd 610 844 Yes ( 0.4738 0.5262 ) *
For a numerical variable, splits are calculated by trying all possible splits between the minimum and maximum value of the variable.
How are the splits enumerated for a categorical variable? Do you have to try all combinations of values? (this would seem to be computationally crazy) Or is there a heuristic you use to limit the number of combinations tried?