scalation.analytics

DecisionTreeID3

class DecisionTreeID3 extends ClassifierInt

The DecisionTreeID3 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
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DecisionTreeID3
  2. ClassifierInt
  3. Error
  4. Classifier
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DecisionTreeID3(xy: MatrixI, fn: Array[String], k: Int, cn: Array[String], vc: VectorI = null)

    Construct a 'DecisionTreeID3 object, passing 'x' and 'y' together in one table.

    Construct a 'DecisionTreeID3 object, passing 'x' and 'y' together in one table.

    xy

    the data vectors along with their classifications stored as rows of a matrix

    fn

    the names for all features/variables

    k

    the number of classes

    cn

    the names for all classes

    vc

    the value count array indicating number of distinct values per feature

  2. new DecisionTreeID3(x: MatrixI, y: VectorI, fn: Array[String], k: Int, cn: Array[String], vc: VectorI = null)

    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

    fn

    the names for all features/variables

    k

    the number of classes

    cn

    the names for all classes

    vc

    the value count array indicating number of distinct values per feature

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: VectorI): (Int, String)

    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
  9. def classify(z: VectorD): (Int, String)

    Given a new continuous data vector 'z', determine which class it belongs to, by first rounding it to an integer-valued vector.

    Given a new continuous data vector 'z', determine which class it belongs to, by first rounding it to an integer-valued vector.

    z

    the vector to classify

    Definition Classes
    ClassifierIntClassifier
  10. def clone(): AnyRef

    Attributes
    protected[java.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. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. 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
  16. 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 of 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).

    dset

    the list of data set tuples to consider (e.g. value, row index)

    value

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

  17. 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))

  18. final def getClass(): Class[_]

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

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

    Definition Classes
    Any
  21. val m: Int

    the number of data vectors in training-set (# rows)

    the number of data vectors in training-set (# rows)

    Attributes
    protected
    Definition Classes
    ClassifierInt
  22. val md: Double

    the training-set size as a Double

    the training-set size as a Double

    Attributes
    protected
    Definition Classes
    ClassifierInt
  23. def mode(a: Array[Int]): Int

    Find the most frequent classification.

    Find the most frequent classification.

    a

    array of discrete classifications

  24. val n: Int

    the number of features/variables (# columns)

    the number of features/variables (# columns)

    Attributes
    protected
    Definition Classes
    ClassifierInt
  25. val nd: Double

    the feature-set size as a Double

    the feature-set size as a Double

    Attributes
    protected
    Definition Classes
    ClassifierInt
  26. final def ne(arg0: AnyRef): Boolean

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

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

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

    Definition Classes
    AnyRef
  30. def test(xx: MatrixI, yy: VectorI): Double

    Test the quality of the training with a test-set and return the fraction of correct classifications.

    Test the quality of the training with a test-set and return the fraction of correct classifications.

    xx

    the integer-valued test vectors stored as rows of a matrix

    yy

    the test classification vector, where yy_i = class for row i of xx

    Definition Classes
    ClassifierInt
  31. def toString(): String

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

    Train the decsion tree.

    Train the decsion tree.

    Definition Classes
    DecisionTreeID3Classifier
  33. def vc_default: VectorI

    Return default values for binary input data (value count (vc) set to 2).

    Return default values for binary input data (value count (vc) set to 2).

    Definition Classes
    ClassifierInt
  34. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ClassifierInt

Inherited from Error

Inherited from Classifier

Inherited from AnyRef

Inherited from Any

Ungrouped