nagdmc predict entropy tree

NAG DMC

Decision Tree: nagdmc predict entropy tree
Purposenagdmc predict entropy tree predicts values for new data given a decision tree computed bynagdmc entropy tree.

Declaration#include <nagdmc.h>void nagdmc predict entropy tree(long rec1, long nvar, long nrec, long dblk,
double data[], long iproot, int optrand,
long iseed, long res[], double prob[],int *info);

Parameters1:

rec1 – long
On entry: the index in the data of the first data record used in the analysis.
Constraint: rec1 ≥ 0.

Input

2:

nvar – long
On entry: the number of variables in the data.
Constraint: nvar > 1.

Input

3:

nrec – long
On entry: the number of consecutive records, beginning at rec1, used in the analysis.
Constraint: nrec > 1.

Input

4:

dblk – long
On entry: the total number of records in the data block.
Constraint: dblk ≥ rec1 + nrec.

Input

5:

data[dblk ∗ nvar] – double
Input
On entry: the data values for the jth variable (for j = 0, 1, . . . , nvar−1) are stored in data[i∗nvar+j],
for i = 0, 1, . . . , dblk − 1.

6:iproot – long
Input
On entry: the integer value of the root node of a decision tree as returned by nagdmc entropy tree.

7:

optrand – int
Input
On entry: if the value of optrand is set equal to 1, a random number will be used to resolve
dichotomies in the decision tree; otherwise optrand must be set equal to 0 and some data records
may be unclassified, i.e., will be classified as -1.
Constraint: optrand ∈ {0, 1}.

8:

iseed – long
Input
On entry: if optrand = 1, the initial values used to set the seed of the random number generator
used to resolve any dichotomies in the tree; otherwise iseed is not referenced.

9:res[nrec] – long
On exit: res[i] contains the decision tree classification for i = 0, 1, . . . , nrec − 1.

10:prob[nrec] – double
OutputOn exit: prob[i] contains the probability of res[i] given the training data, for i = 0, 1, . . . , nrec − 1.

11:

info – int *On exit: info gives information on the success of the function call:

OutputOutput0: the function successfully completed its task.
i; i = 1, 2, 3, 4, 7: the specification of the ith formal parameter was incorrect.
99: the function failed to allocate enough memory.
100: an internal error occurred during the execution of the function.

nagdmc predict entropy tree.1

nagdmc predict entropy tree

NAG DMC

Notation
nrec
dataresprob

the number of data records used to predict values, n.
data records xi , for i = 1, 2, . . . , n.
decision tree classifications yi , for i = 1, 2, . . . , n.
accuracy of classifications ai , for i = 1, 2, . . . , n.

Description
Let xi , for i = 1, 2, . . . , n be a set of n data records not used to fit a decision tree, T . The ith
predcition for the dependent variable in the data is found by using the outcome of a series of tests
at the root node and internal nodes in T to associate xi with leaf node li , for i = 1, 2, . . . , n. The
value of the dependent variable stored at li is then used as the predicted value yi , for i = 1, 2, . . . , n.
In a decision tree calculated by using an entropy criterion each leaf node stores the modal class ofthe dependent variable over a subset of the data records.
The outcome of each test depends on the type of variable used to partition data records at thenode. Let a test at a node k be on variable j in the data and xij be the value of the ith data record
on variable j.
If j is continuous, xi is sent to the left child node of node k if xij ≤ t, where t is the value of thecontinuous test as stored in node k; otherwise xi is sent to the right child node of node k.
If j is categorical, xi is sent to the node associated with the category value xij . However, when thedecision was fitted there may not have been a category value xij at node k and, therefore, either
the ith data record can be assigned an unclassified value or a child node can be chosen at random
from those available to node k.
This process of evaluating tests continues until xi reaches a leaf node, say li , in T .
A measure of the accuracy of the ith prediction can be obtained by considering the class distrbutionof data records at leaf node li , for i = 1, 2, . . . , n. Suppose that ri of mi data records associatedwith li (and used to fit T ) belong to the modal class, then a measure of the accuracy ai of theclassification is given by,
ai =ri,mii = 1, 2, . . . , n.

References and Further Reading
None.

See Also
nagdmc entropy tree
nagdmc free entropy tree
nagdmc load entropy tree
nagdmc prune entropy tree
nagdmc save entropy treeentropy tree ex.ccomputes an decision tree by using an entropy-based criterion.
returns to the operating system memory used by an entropy tree.
loads an entropy tree from a file.
prunes an entropy tree using pessimistic error pruning.
writes an entropy tree to a file.
the example calling program.

nagdmc predict entropy tree.2