scalation.analytics

DecisionTreeC45

class DecisionTreeC45 extends Classifier with Error

This class implements a Decision Tree classifier using the C4.5 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. DecisionTreeC45
  2. Error
  3. Classifier
  4. AnyRef
  5. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DecisionTreeC45(x: MatrixI, y: Array[Int], featr: Array[String], isCont: Array[Boolean], 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

    featr

    the string array holding the feature names

    isCont

    boolean value to indicate whether according feature is continuous

    vc

    the value count array indicating number of distinct values per feature

    k

    the number of classes

Type Members

  1. class Node extends AnyRef

    Class that contains information for a tree node.

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(opt: (Int, Double)): Unit

    Given the next most distinguishing feature/attribute, extend the decision tree.

    Given the next most distinguishing feature/attribute, extend the decision tree.

    opt

    the optimal feature and its gain

  8. def calThreshold(f: Int): Unit

    Given a continuous feature, adjust its threshold to improve gain.

    Given a continuous feature, adjust its threshold to improve gain.

    f

    the feature index to consider

  9. def classify(z: VectorD): 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 (some continuous features)

    Definition Classes
    DecisionTreeC45Classifier
  10. 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 (purely discrete features)

    Definition Classes
    DecisionTreeC45Classifier
  11. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  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(fCol: VectorI, value: Int, cont: Boolean = false, thres: Double = 0): (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).

    fCol

    a feature column to consider (e.g., Humidity)

    value

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

    cont

    indicates whether is calculating continuous feature

    thres

    threshold for continuous feature

  18. def gain(f: Int): 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. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  23. def nextXY(f: Int, value: Int): (MatrixI, Array[Int])

    Return new x matrix and y array for next step of constructing decision tree.

    Return new x matrix and y array for next step of constructing decision tree.

    f

    the feature index

    value

    one of the features values

  24. final def notify(): Unit

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

    Definition Classes
    AnyRef
  26. def printTree: Unit

    Print out the decision tree using Breadth First Search (BFS).

  27. var root: Node

  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  29. var threshold: Array[Double]

  30. def toString(): String

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

    Train the classifier, i.

    Train the classifier, i.e., determine which feature provides the most information gain and select it as the root of the decision tree.

    Definition Classes
    DecisionTreeC45Classifier
  32. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()
  35. val x: MatrixI

    the data vectors stored as rows of a matrix

  36. val y: Array[Int]

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

Inherited from Error

Inherited from Classifier

Inherited from AnyRef

Inherited from Any