Algorithm (predict) - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English

Predict stage is the process of making a decision using a decision tree. Starting from the root node, test the corresponding feature attributes in the item, and select the output branch according to its value until it reaches the leaf node. Finally, use the category value or regression value stored by the leaf node as the decision result.

The decision tree can be linearized into decision rules, where the outcome is the contents of the leaf node, and the conditions along the path form a conjunction in the if clause. In general, the rules have the form: if condition1 and condition2 and condition3 then outcome.

Suppose :match:`N` is the number of samples, :match:`Nodes`, an array of special data structure, represents a decision tree.:math:MAX_DEPTH is max depth of decision tree.

The detailed algorithm: Input: a sequence of samples and Decision Tree (marked as \(nodes\)). Output: a sequence of predict results.

For m from 1 to \(N\)
For k from 1 to \(MAX_DEPTH\)
if \(nodes[k]\) is not leaf node
test corresponding feature attributes and select a branch.
else
output the category or regression value of current node. break