I think you want:
t.CutVar{1}
ans =
x1
Question
I'm using the next code to train a ClassificationTree with one node (Decision stump), using the CutPoint property i was able to get the value of the predicate split, but how can i get the predicate used ? (in this example feature1 or feature2)
x1 = 10 * rand(10, 1);
x2 = 10 * rand(10, 1);
x = [x1 x2];
y = randi(2, 10, 1);
t = ClassificationTree.fit(x, y, 'MinParent', 10, 'MergeLeaves', 'off');
view(t)
t.CutPoint(1,:)
Output
Decision tree for classification
1 if x1<3.60576 then node 2 elseif x1>=3.60576 then node 3 else 1
2 class = 1
3 class = 2
ans =
3.6058
so i was able to get the value 3.6058 but i need a way to get that x1 was the feature used.
Solution
I think you want:
t.CutVar{1}
ans =
x1