trait DecisionTree extends Error
The DecisionTree
trait provides common capabilities for all types of
decision trees.
- Alphabetic
- By Inheritance
- DecisionTree
- Error
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- def add(n: Node, vc: (Int, Node)*): Unit
Add multiple child nodes to the tree via branchs from node 'n'.
Add multiple child nodes to the tree via branchs from node 'n'.
- n
the parent node
- vc
the branch value and child node, repeatable
- def add(n: Node, v: Int, c: Node): Unit
Add child node 'c' to the tree via branch 'v' from node 'n'.
Add child node 'c' to the tree via branch 'v' from node 'n'.
- n
the parent node
- v
the branch value from the parent node
- c
the child node
- def addRoot(r: Node): Unit
Add the root node to the tree.
Add the root node to the tree.
- r
the root node of the tree
- def calcEntropy(nodes: ArrayBuffer[Node] = leaves): Double
Calculate the entropy of the tree as the weighted average over the list of nodes (defualts to leaves).
Calculate the entropy of the tree as the weighted average over the list of nodes (defualts to leaves).
- nodes
the nodes to compute the weighted entropy over
- def classify2(z: VectoD): Int
Given a data vector z, classify it returning the class number (0, ..., k-1) by following a decision path from the root to a leaf.
Given a data vector z, classify it returning the class number (0, ..., k-1) by following a decision path from the root to a leaf. If no branch found, give maximal decision of current node. Return the best class and its name.
- z
the data vector to classify
- def classify2(z: VectoI): Int
Given a data vector z, classify it returning the class number (0, ..., k-1) by following a decision path from the root to a leaf.
Given a data vector z, classify it returning the class number (0, ..., k-1) by following a decision path from the root to a leaf. If no branch found, give maximal decision of current node. Return the best class and its name.
- z
the data vector to classify
- final def flaw(method: String, message: String): Unit
- Definition Classes
- Error
- def makeLeaf(n: Node): Unit
As part of tree pruning, turn an internal node into a leaf.
As part of tree pruning, turn an internal node into a leaf.
- n
the node to turn into a leaf (pruning all nodes below it)
- def printTree(): Unit
Print the decision tree using 'prinT' method from
Node
class. - def reset(): Unit
Reset or re-initialize counters, if needed.