scalation.analytics

NaiveBayesInt

class NaiveBayesInt extends ClassifierInt

The NaiveBayesInt class implements an Integer-Based Naive Bayes Classifier, which is a commonly used such classifier for discrete input data. 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. Prior probabilities are calculated based on the population of each class in the training-set. Relative posterior probabilities are computed by multiplying these by values computed using conditional probabilities. The classifier is naive, because it assumes feature independence and therefore simply multiplies the conditional probabilities.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. NaiveBayesInt
  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 NaiveBayesInt(x: MatrixI, y: VectorI, fn: Array[String], k: Int, cn: Array[String], vc: VectorI = null, me: Int = 3)

    x

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

    y

    the class vector, 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 (number of distinct values) for each feature

    me

    use m-estimates (me == 0 => regular MLE estimates)

Value Members

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

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def checkCorrelation: Unit

    Check the correlation of the feature vectors (fea).

    Check the correlation of the feature vectors (fea). If the correlations are too high, the independence assumption may be dubious.

  6. def classify(z: VectorI): (Int, String)

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

    Given a discrete data vector 'z', classify it returning the class number (0, ..., k-1) with the highest relative posterior probability.

    z

    the data vector to classify

    Definition Classes
    NaiveBayesIntClassifier
  7. 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
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. 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
  13. def frequencies(): Unit

    Count the frequencies for 'y' having class 'i' and 'x' for cases 0, 1, .

    Count the frequencies for 'y' having class 'i' and 'x' for cases 0, 1, ...

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

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

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

    Definition Classes
    Any
  17. 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
  18. val md: Double

    the training-set size as a Double

    the training-set size as a Double

    Attributes
    protected
    Definition Classes
    ClassifierInt
  19. val n: Int

    the number of features/variables (# columns)

    the number of features/variables (# columns)

    Attributes
    protected
    Definition Classes
    ClassifierInt
  20. val nd: Double

    the feature-set size as a Double

    the feature-set size as a Double

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

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

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

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

    Definition Classes
    AnyRef
  25. 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
  26. def toString(): String

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

    Train the classifier by computing the probabilities for C, and the conditional probabilities for X_j.

    Train the classifier by computing the probabilities for C, and the conditional probabilities for X_j.

    Definition Classes
    NaiveBayesIntClassifier
  28. 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
  29. final def wait(): Unit

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. 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