scalation.analytics

DecisionTreeID3

class DecisionTreeID3 extends Classifier with Error

This class implements a Decision Tree classifier using the ID3 algorithm. The classifier is trained using a data matrix x and a classification vector y. Each data vector in the matrix is classified into one of k classes numbered 0, ..., k-1. Each column in the matrix represents a feature (e.g., Humidity). The vc array gives the number of distinct values per feature (e.g., 2 for Humidity).

Linear Supertypes
Error, Classifier, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. DecisionTreeID3
  2. Error
  3. Classifier
  4. AnyRef
  5. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DecisionTreeID3(x: MatrixI, y: Array[Int], vc: Array[Int], k: Int = 2)

    x

    the data vectors stored as rows of a matrix

    y

    the class array, where y_i = class for row i of the matrix x

    vc

    the value count array indicating number of distinct values per feature

    k

    the number of classes

Type Members

  1. case class FeatureNode(f: Int, branches: HashMap[Int, Node]) extends Node with Product with Serializable

  2. case class LeafNode(y: Int) extends Node with Product with Serializable

  3. abstract class Node extends AnyRef

  4. type Path = List[(Int, Int)]

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def buildTree(path: Path): Node

    Extend the tree given a path e.

    Extend the tree given a path e.g. ((outlook, sunny), ...).

    path

    an existing path in the tree ((feature, value), ...)

  8. def classify(z: VectorD): Int

    This implementation of ID3 does not support continuous data.

    This implementation of ID3 does not support continuous data.

    z

    the data vector to classify

    Definition Classes
    DecisionTreeID3Classifier
  9. def classify(z: VectorI): Int

    Given a data vector z, classify it returning the class number (0, .

    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.

    z

    the data vector to classify

    Definition Classes
    DecisionTreeID3Classifier
  10. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def dataset(f: Int, path: Path): Array[(Int, Int)]

    Extract column from matrix, filtering out values rows that are not on path.

    Extract column from matrix, filtering out values rows that are not on path.

    f

    the feature to consider (e.g., 2 (Humidity))

  12. def entropy(prob: VectorD): Double

    Given a k-dimensional probability vector, compute its entropy (a measure of disorder).

    Given a k-dimensional probability vector, compute its entropy (a measure of disorder).

    prob

    the probability vector (e.g., (0, 1) -> 0, (.5, .5) -> 1)

    See also

    http://en.wikipedia.org/wiki/Entropy_%28information_theory%29

  13. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  16. def flaw(method: String, message: String): Unit

    Show the flaw by printing the error message.

    Show the flaw by printing the error message.

    method

    the method where the error occurred

    message

    the error message

    Definition Classes
    Error
  17. def frequency(dset: Array[(Int, Int)], value: Int): (Double, VectorD)

    Given a feature column (e.

    Given a feature column (e.g., 2 (Humidity)) and a value (e.g., 1 (High)) use the frequency of ocurrence the value for each classification (e.g., 0 (no), 1 (yes)) to estimate k probabilities. Also, determine the fraction of training cases where the feature has this value (e.g., fraction where Humidity is High = 7/14).

    value

    one of the possible values for this feature (e.g., 1 (High))

  18. def gain(f: Int, path: Path): Double

    Compute the information gain due to using the values of a feature/attribute to distinguish the training cases (e.

    Compute the information gain due to using the values of a feature/attribute to distinguish the training cases (e.g., how well does Humidity with its values Normal and High indicate whether one will play tennis).

    f

    the feature to consider (e.g., 2 (Humidity))

  19. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  21. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  22. def mode(a: Array[Int]): Int

    Find the most frequent classification.

    Find the most frequent classification.

    a

    array of discrete classifications

  23. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. def train(): Unit

    Train the decsion tree.

    Train the decsion tree.

    Definition Classes
    DecisionTreeID3Classifier
  29. var tree: Node

  30. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  31. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  32. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Error

Inherited from Classifier

Inherited from AnyRef

Inherited from Any