Visualization of decision tree
I have a table in which all of its columns are categorical variables, and the label associated with them is also a categorical variable. I use this piece of code to fit a tree to the data:
Mdld = fitctree(X,Ycat,’MaxNumSplits’,5,’PredictorSelection’,’curvature’,…
‘CrossVal’,’on’);
when I plot the tree, the variables will be converted to a ordinal variable which is hard to track back what is the original variables that I had in table X. You can see the results here:
view(Mdld.Trained{1},’Mode’,’graph’)
As you see, the labels are correct, but for example, in the X table, I have "Small" and "Large" categories for vessel radius, but I get 1 and 2 labels instead, for which I event do not know readily which one is which!
I could not find a way to keep the labels on the node. Can anyone help me to do so?I have a table in which all of its columns are categorical variables, and the label associated with them is also a categorical variable. I use this piece of code to fit a tree to the data:
Mdld = fitctree(X,Ycat,’MaxNumSplits’,5,’PredictorSelection’,’curvature’,…
‘CrossVal’,’on’);
when I plot the tree, the variables will be converted to a ordinal variable which is hard to track back what is the original variables that I had in table X. You can see the results here:
view(Mdld.Trained{1},’Mode’,’graph’)
As you see, the labels are correct, but for example, in the X table, I have "Small" and "Large" categories for vessel radius, but I get 1 and 2 labels instead, for which I event do not know readily which one is which!
I could not find a way to keep the labels on the node. Can anyone help me to do so? I have a table in which all of its columns are categorical variables, and the label associated with them is also a categorical variable. I use this piece of code to fit a tree to the data:
Mdld = fitctree(X,Ycat,’MaxNumSplits’,5,’PredictorSelection’,’curvature’,…
‘CrossVal’,’on’);
when I plot the tree, the variables will be converted to a ordinal variable which is hard to track back what is the original variables that I had in table X. You can see the results here:
view(Mdld.Trained{1},’Mode’,’graph’)
As you see, the labels are correct, but for example, in the X table, I have "Small" and "Large" categories for vessel radius, but I get 1 and 2 labels instead, for which I event do not know readily which one is which!
I could not find a way to keep the labels on the node. Can anyone help me to do so? decision tree, view, visualize, categorical variables MATLAB Answers — New Questions