# Read Categorical Value split in Random forest in R

I Have a dataset which contains various categorical variables and no numeric variable. I converted the variables to ordered factors by:

df$$colA= factor(df$$colA,levels=unique(df$colA), ordered=TRUE)  Now I am making a random forest model and then making a tree using below code: getTree(model.rf, 1, labelVar=TRUE) #model.rf is the model created using df and various columns  I get the tree something like below:  left daughter right daughter split var split point status prediction 1 2 3 colA 1.5 1 <NA> 2 4 5 colB 2.5 1 <NA>  and so on.... # Ask: Both my split var are ordered factor categorical variables. Now how do I interpret split point as 1.5 or 2.5. I can't say the split is between two groups. To explain it further: Lets say ColA is Gender with levels as M or F and ColB is Weight with levels as High Medium Low. Now to explain it to stakeholders I can't say when the gender is between Male and Female and the Weight is between Medium to High.. the probability of happening something is high. Can someone help me in how to explain RF tree when dealing with categorical variable? • I think you have misunderstood how decision trees work. The split creates two nodes, a left and a right node. There is no value associated with the split itself. The tree is not saying anything about "gender ... between Male and Female", it's saying "at this node of the tree, we create two daughter nodes, one for values of ColA$\leq 1.5$(e.g., Female) and one for values$>1.5\$ (e.g., Male)." It is not saying anything about the probability of something happening when the gender is between Male and Female. – jbowman Oct 4 '18 at 14:14
• Ok..But when there are three levels kike Low =1 Medium =2 and high = 3 and the split comes 2.5. Then is it like, >2.5 then High and less than 2.5 Medium? Is my understanding correct ? – Rahul Agarwal Oct 4 '18 at 14:39
• No, less than 2.5 is "Medium or low". Both Medium and Low are < 2.5. – jbowman Oct 4 '18 at 15:04
• In that case how do I read or interpret 1 branch from bottom to top? How can I drive insights ? I know somewhere in the end.. prediction will be my dependent variable. – Rahul Agarwal Oct 4 '18 at 15:06
• You might want to look up "decision tree" to learn more about them, e.g., en.wikipedia.org/wiki/Decision_tree. A random forest is a collection of decision trees, and, as such, is not readily interpretable without supplemental analysis tools, e.g., the DALEX or Ceteris Paribus packages in R. – jbowman Oct 4 '18 at 15:10