Help Topics Concepts Package Class

## Decision Tree Bean Properties and Use

### Properties

Metric parameter
  Represents the metric used for selecting the best attribute at each node. It could be one of the following: gainRatio (0), chiSquare (1), laplace (2), gini (3), relief (4), contextInfo (5), intraInterDist (6). The metric can be changed between different runs of the algorithm.

Discretization parameter
  Represents the number of intervals used for to discretize continuous attributes. The discretization parameter can be changed between different runs of the algorithm.

numAttributes
  Represents the number of attributes. This property is set when the decision tree bean is created based on the data in the input file, and cannot be changed later.
numClasses
  Represents the possible classes for a particular data set. This property is set when the decision tree bean is created based on the data in the input file, and cannot be changed later.
numRecords
  Represents the number of records in the input file. This property is set when the decision tree bean is created based on the data in the input file, and cannot be changed later.
Mode
  Select one of the following agent modes:
  Train implies that the data is read from the Import corresponding to the input file and used to construct the decision tree model.
  Test implies that the decision tree model is used to classify new data and compute the accuracy of classification based on known labels of test data.
  Run implies that the model is used to classify new data as it is process. No feedback about accuracy can be given in this case, as the correct labels are not known.

### Use

The Decision Tree Bean panel is used to create a decision tree classifier with the specified parameters. The Mode should be set only to test or run values once the input data has been stored in the model.

After the data is stored, the mode is automatically set to test. It can be changed manually to run. The metric and discretization parameters can also be manually changed.

Steps in using the decision tree panel include:

1. Set the mode, metric and discretization parameters, if necessary. Press the OK button to apply changes.
2. Create inspectors on the inspectable properties (inputBuffer, outputBuffer, accuracy, error etc.).
3. Optionally connect another Import Bean if you wish to use independent data for testing.
4. Press the Step button on the Agent Editor toolbar and view the input data and decision tree result in the inspectors, or
5. Press the Cycle button on the AgentEditor to cycle through all the examples in the test set.
6. Inspect the desired properties (e.g. accuracy) and change metric or discretization parameters if the current value is not satisfactory.

In run mode, data is processed similar to test but statistical properties like accuracy and error are not calculated.

If you press the Reset button, you reset the bean's statistics such as total number of examples processed, number of correctly classified examples, accuracy and error.