I'm new to TreeBagger in Matlab. I devised 2 simple cases to learn TreeBagger (Random forest). Suppose the independent variable is z:
First case: 1 variable:
z = {'hi';'hi';'hi';'hi';'hi';'hi';'low';'low';'low';'low';'low';'low'};
and the predictor variables is x, and y:
x = [1 1 1 1 2 1 2 2 2 2 1 2];
Second Case: 2 variables
Same as before but with an additional variable y:
y = [1 1 1 2 1 1 2 1 2 2 1 2];
Solving for Case 1:
b = TreeBagger(1,x,y, 'Method','classification','NVarToSample',1,'oobpred','on');
What I want:
Case 1&2: Visualize the classification tree used (I chose one), and also to see the splitting threshold...
Somebody told me the answer. You can view the Tree 1 typing:
view(B.Trees{1})