COMMAND(1)

NAME
tclass - classify a test set using a decision tree

SYNOPSIS
tclass [options] attribute_file tree_file(s) [test_file]

tclass [options] stem

DESCRIPTION

tclass takes a test set and classifies it according to the given tree(s). The test set has the same format as the input data for tgen so a decision attribute must be given. The second form uses the stem instead of explicitly specifying the attribute, examples and output files and assumes files "stem.attr", "stem.enc" and "stem.tree" exist. If multiple n trees are input, the final class probability vectors from each tree are merged (by default, averaged) to give an (n+1)-th prediction. This is termed the "multiple tree". Statistics can be reported for both the individual trees and/or the multiple tree. The facilities in tgen for generating multiple trees are currently under repair.

If the attribute_file contains a utilities specification, then average utility is also printed with any statistics and the best decision is calculated to maximize expected utility. Otherwise, the class with maximum probability is chosen (i.e., minimum errors utility).

The usual output mode for tclass is fairly verbose. Output will be brief and restricted to a single line with the -b option. The order of output in this case is mostly the same as for verbose mode except that no explanation, etc. will be given, simply a line of numbers. So run the verbose mode first to determine the order, before using the brief mode, then compare the numbers see the precise order fields are printed for the brief mode. The order for a single tree is as follows: percentage correct, half-brier score, predicted percentage correct (with -s option), standard deviation of prediction (with -v option), log posterior probability (with -g option), if the tree was grown with cross validation, the cross validation estimate of percentage accuracy and its standard deviation (with -G option), node count and expected number of nodes (with -l option), and utility on training sample (if utilities exist in attribute_file.).

If trees were pruned with the -b option then tree smoothing is done during classification. During classification, an example falls down a given branch. Without smoothing, the class probability for the example is taken from the leaf to which the example falls. With smoothing, the class probabilities are averaged along the entire branch. The averaged is weighted according to a Bayesian formula computed by tprune and stored in the class probability tree. Usually the nodes lower down the tree will dominate in the weights.

OPTIONS

-b  Make summary of performance briefer. Useful if the output is later piped to a statistics program.

-c  Print for each example the given class. This option combines nicely with option -d.

-D  Print for each example the decision for each tree (use with the -m option).

-d  Print for each example the decision for the single tree, or if several trees exist, the multiple tree. This option combines nicely with option -c.

-e  By default tclass assumes the example file is encoded and to be sampled automatically (see enc(1) and encsmpl(1)). This flag makes tclass read in the example file as a text file complete.

-f  Print for each example and for each tree whether the decision agreed with the actual class (1=yes, 0=no). Useful for comparative statistical analysis of tree accuracy.

-g  Print out the posterior for the trees as well (taken from the header). Can print garbage if the tree was pruned with the -n option, or grown with a cost-complexity pruning option.

-G  Assuming the tree was generated using the -C option of tgen using cost-complexity pruning, this prints out the error estimate for the tree calculated during the cross validation procedure. Only works if the tree was pruned with the -n option rather than Bayes pruning. Notice the estimate will be biased because the cost-complexity tradeoff parameter was selected to minimise errors.

-l  Print out the leafcount (both the expected and actual sizes) for each tree.

-m n
    Classify multiple trees, where n is the number of trees. The n trees are listed in the tree_file(s) argument. If the -m option is not used, one tree is assumed.

-o  Choose best decision simply by picking the class with highest probability (i.e. ignore utilities).

-P  For each example, print out the probability estimates for each class and for each tree (use with the -m option).

-p  For each example, print out the probability estimates for each class for the single tree, or if several trees exist, the multiple tree. When coupled with the -v option prints their variance as well.

-Q  Print out details of the tree prior (assumed constant across multiple trees) once at the beginning.

-q  When using multiple trees, prints out a matrix representing differences between trees. The second row and column of the matrix represents the differences of other trees with the second tree, etc. (the last row and column, the multiple tree). Useful for determining which single tree is most similar to the multiple tree. Differences are measured in terms of the proportion of examples on whose classification two trees disagree (in the upper triagonal) and the average over the examples of the manhattan distance between class probability vectors produced by two trees on an example (in the lower triagonal).

-S  Print out a summary of performance for each tree (use with the -m option).

-s  Print a summary of performance for the single tree, or if several trees exist, the multiple tree. This includes accuracy, mean square error, expected accuracy (the classifier's prediction of what accuracy it should have got, found by averaging the class probabilities at the leaves) and an optional average utility. Expected accuracy is usually an over estimate, except in the case of a small tree with "lots" of data, or in the case of an option tree built using the -J option to tgen and realistic prior parameters.

-t  Print out with the other statistics a misclassification matrix of predicted classes by actual classes for trees (either the -s or the -S options must be used). Classes appear in the order they are given in attribute_file.

-U n
    How to handle unknowns when classifying. The methods available are:

    1   Send the unknown down each branch with proportion as found in the training set at that node.

    3   Send unknown down the most common branch (the default).

    4   Send the unknown down a single branch chosen with probability proportional to that found in the training set at that node.

-v  For each example, a standard deviation of the expected accuracy is calculated. The average of these variances is then printed. Unfortunately, this is not a standard deviation for the expected accuracy of the sample (this much more complicated formula is not calculated), but the value gives a generous over-estimate of the imprecision in the expected accuracy of the sample. If the tree was pruned by tprune with -bD options together, then the value returned will be meaningless.

-w  When averaging class probabilities from multiple trees, calculate weights by ratioing the posterior for each tree (which is stored in the tree header). By default, weights are all equal.

-W  "w1 ... wm"
    When averaging class probabilities from multiple trees, weight the i-th tree by the weight wi (only use with the -m option). Weights are white space delimited (so the argument must be enclosed in quotes).

-Z  In regular non-smoothed trees, leaf nodes which have zero count are assigned the same class probabilities as their parent. With this flag set, zero-count nodes are assigned the class probabilities found at the root of the tree. In smoothed trees, produced with the -b option to tprune, this option is ignored because smoothing makes class probabilities equal to the priors.

SEE ALSO
tgen(1), tprune(1), mktree(1), ttest(1).