Decision Trees
Decision Tree Objects are the primary knowledge representation format in Viabl.ai and consist of different types of connected “Nodes” which can be viewed and edited via the Decision Tree Editor.
Decision Tree Editor
The editor not only provides features for acquiring the knowledge but also for displaying it in a simple intuitive form; so a developer can quickly get back up to speed maintaining the knowledge or for presenting the knowledge to a fresh audience as decision trees are easy to ‘read’ and mentally ‘execute’.
The editor is composed of 3 elements – the main pane, the object palette and the toolbar.
- The main pane is where the tree is constructed and viewed; and as previously stated a tree consists of different types of connected “Nodes”. The node types employed in the tree often depend on the deployment target and the category of application, but all object types in the Catalog can be used in the Decision Tree main pane. Each node when selected has a context menu (also known as a node’s burger menu) to perform actions at that point. With nodes linked to other nodes by branches (also known as splits) leading to endpoints that are the leaves of the tree and are set with outcome values of the Decision Tree object. When a tree is created there is just an initial ‘Empty’ leaf node, and by repeatedly using the context menu to add new nodes and branches the tree can be extended. This process of adding nodes is repeated until all the leaves have been set with outcome values and the tree can be executed at runtime. Nodes can be added not only by the context menu points but also by dragging and dropping existing objects from the Object Catalog, Build Tools or Object Palette.
- The object palette is a collapsible view on the right of the main pane. This palette holds a list of objects which have been used in the construction of the tree and is a localised sub-set of the Object Catalog. It provides an easy way of editing the tree by dragging from this palette and dropping to a node on the main pane, and as objects are added to the main pane this palette is updated. The palette is also useful in locating all the occurrences of an object in the main pane with the magnifying-glass icon to the right of the object name. In a similar manner at the bottom of the palette is a facility for finding where an outcome value of the decision tree is used in the main pane.
- The toolbar provides a number of commonly used functions:
- Editing the object settings of the decision tree itself.
- Generating the essential example set from the tree (when possible) in table form, CSV form or DMN form
- Adjusting the main pane view by zooming in/out
- Copying sections of the tree and pasting these sub-trees within this main pane or other Decision Tree Object’s main pane
- Undo last operation
- Tree display settings
- Saving and closing the editor
Each Tree node has a context sensitive menu (shown just below it when it is highlighted), the top part of the menu is concerned with extending the tree with appropriate ways of adding further nodes and the lower part of the menu with the following options:
- Edit: This option provides access to the main settings of the selected Object
- Edit Advanced Settings: This option allows the editing of the advanced Properties and Events of the selected Object. Note this menu option is only visible if the "Show advanced menus" has been checked in the User Preferences (accessible from the right-hand burger menu).
- Rename: The object can be renamed using this option
- Locate Object: Find and highlight this object in the Decision Map and Object Catalog
- Copy: This option allows the either the selected node or the node and its sub-tree
- Delete Node: This deletes the selected node
- Convert Selected Node to Split / No-Split: Switch the Node from "Split Node" to a "No-Split" and visa versa
Toolbar
The Decision Tree editor has a toolbar on the top right side with the following actions:
- Object Settings: This provides access to all the Tree Object's Properties, Outcome Values & Events
- Generate Essential Decision Table: This option allows the general logic of the tree to be displayed in specific form as either tabular, CSV or DMN form (so long as there is no looping, sequence nodes, object/object comparison or property splits involved)
- Zoom In / Zoom Out: This option changes the view size for all the Decision Tree editors
- Copy / Paste: The copy and paste sub-tree option extends to copying between Decision Tree editors
- Undo: This will undo the last operation
- Tree Display Settings: This provide access to the settings which effects the way all Decision Trees in the Knowledge-base are displayed
- Save: This saves any changes to the local browser cache only and does not save this to the server until "Save Knowledge-base" is used on the top most right-hand toolbar.
- Close: This closes the editor and will prompt to save any unsaved edits
Node Menu
The following can be accessed directly via the node menu which appears when a Decision Tree node is selected:
Object Palette
The Object Palette is a panel on the right-hand side of the Decision Tree editor containing a list of the objects that are used on that particular tree, (the list can be set by the User Preferences to retain names of objects that were previously used in building the tree). The palette fulfills a number of purposes - the means to find where listed objects are used on the tree, to extend the tree by dragging and dropping any of the listed objects onto the tree, and to locate where any of the outcome values of the Decision Tree object are used at the Leaf nodes. The panel can be resized by dragging the divider, or simply toggled open/closed by clicking the center portion of the divider.
Settings
The appearance of the Decision Tree and how menus/selections behave within it can be controlled via the following...
Decision Tree Nodes
Nodes can result in splits or branches in the tree and this depends mainly on the object type used at the node.
Multi-way Split Nodes
A Multi-way Split Node is a decision point where multiple branches provide a choice of decision paths for the inference engine to follow. It can be created by adding any Variable Object. A Variable Object is a Viabl.ai Object (such as Question, Decision Tree, etc) of any type (List, Numeric, etc) that is derived from a Base Class and which acquires its value at runtime. Each Node split branch represents the condition that the Object’s runtime value must satisfy for the runtime inference to continue down a given branch.
The nature of conditions that can be expressed in a Multi-way Split Node branch will depend on the Variable Object’s type:
- List (single-select)
- This supports multiple branches (defaults to one branch per value)
- Can assign one or more List value per branch (all List values must be assigned to a branch)
- Optional “Otherwise” branch
- Optional “Is Blank” branch
- Optional Split on a “List Value Property” of the List Object (Boolean or Numeric type Properties only with the node split according to this type)
- List (multi-select)
- This always creates two branches only
- List Values combined with a set membership function in the first branch
- Mandatory second “Otherwise” branch
- Boolean
- This always creates two branches only (“Yes” and “No” branches)
- Optional “Is Blank” branch as a third branch
- Optional Split on a “List Value Property” of the Boolean Object (Boolean or Numeric type Properties only with the node split according to this type)
- Numeric
- This can support multiple branches
- Comparisons: =, <> or combinations of <, <=, >=, > per branch
- Optional “Variable Threshold” (where it is compared with another Numeric Object)
- Optional “Otherwise” branch (when there are 3 or more branches)
- Optional “Is Blank” / “Is Not Blank” branch
- Date
- This can support multiple branches
- Comparisons: =, <> or combinations of <, <=, >=, > per branch
- Optional “Variable Threshold” (where it is compared with another Date Object)
- Optional “Otherwise” branch (when there are 3 or more branches)
- Optional “Is Blank” branch
- Text
- This can support multiple branches
- A choice of text matching techniques (Regex, Tf-idf, etc) per split (across branches)
- Mandatory “Otherwise” branch
- Optional “Is Blank” branch
No-Split Nodes
- All Variable Object types can (optionally) be used as a No-Split
- Dialog Objects
- Report Objects
- Hierarchy Objects
- Lookup Objects
- Script Objects and Embedded Scripts (also known as tree scripts)
All-Values Node
- An Option when creating a Node with a List Object (single-select)
- Creates a single branch with all the Object’s List values
- Logically equivalent to “No-Split” Node (during inference)
- Typically used as an interim before adding further branches (a quick way of editing a large number of List values between a small number branches)
Leaf Nodes
- ‘Empty’
- Outcome Value (Setting Outcomes)
- List (single-select)
- List (multi-select)
- Boolean (Yes or No)
- Numeric
- Date
- Text
- Jump (to Jump point node)
- Sequence Node Continuation Marker
Jump Point Nodes
- Created by the action of dragging a leaf node to another node in the tree
- If an endless looping situation is detected a warning will be issued
Tree Sequence Nodes
- Two or more branches are executed in sequence
- Inference differs based on
- Single-select Outcome Value
- Multi-select Outcome Value
Related Topics
Inference
Inference is the process by which the Decision Tree is executed at runtime.
Methodology
The following is a list of useful topics that can help when building Decision Trees
Decision Map
Decision Trees can be modified by certain Decision Map options, including the following...