How does predict work for decision trees?

1 view (last 30 days)
HSch
HSch on 26 Mar 2017
Answered: Anoop Somashekar on 30 Mar 2017
So as far as I understand it, any input gets classified according to the structure of the trained tree and its leaves. But how does the cost-matrix that can be specified come into play if the prediction itself is fixed? (The documentation states that the cost is considered at the prediction process, but isn't it really already considered when the tree is constructed?)
http://de.mathworks.com/help/stats/compactclassificationtree.predict.html Especially the 'Predict Class Label' definition does not make any sense to me if the tree is completely determined already.
Would really appreciate help with this since it is urgent and completely confuses me.

Answers (1)

Anoop Somashekar
Anoop Somashekar on 30 Mar 2017
Cost matrix is used while building the tree as described in the fitctree document. By default, the cost is 0 for correct classification, and 1 for incorrect classification. It can be overridden by specifying cost name-value pair while using 'fitctree' method. If the cost matrix is specified in 'fitctree' method then the tree structure might be different as compared to the tree structure built using default cost matrix.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!