Search code examples
matlabtreeviewmatlab-figurerandom-forest

Extracting decision split values from tree graph


I am using treebagger for classification and plotted the tree graph. However, how do i extract/save values (766,4.35,2.11) from each node in the graph? Attached is the plot and below is my code:

Mdl= fitctree(Xtrain,Ytrain,'MaxNumSplits',4,'CrossVal','on');
        view(Mdl.Trained{1},'Mode','graph')

enter image description here


Solution

  • The property that you're looking for is CutPoint.

    >> Mdl.Trained{1}.CutPoint
    ans =
      766.0000
        4.3500
        2.1180