scalation.analytics

BayesClassifier

class BayesClassifier extends Classifier with Error

This class implements a Naive Gaussian Bayes Classifier. 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 density functions based on the Normal (Gaussian) distribution. The classifier is naive, because it assumes feature independence and therefore simply multiplies the conditional densities.

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

Instance Constructors

  1. new BayesClassifier(x: MatrixD, y: Array[Int], k: Int = 2)

    x

    the data vectors stored as rows of a matrix

    y

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

    k

    the number of classes

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 calcHistogram(x_j: VectorD, intervals: Int): VectorD

    Compute the counts for each interval in the histogram.

    Compute the counts for each interval in the histogram.

    x_j

    the vector for feature j given class c.

    intervals

    the number intervals

  8. def calcStats(): Unit

    Calculate statistics (sample mean and sample variance) for each class by feature.

  9. 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.

  10. def classify(z: VectorD): Int

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

    Given a continuous 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
    BayesClassifierClassifier
  11. def classify(z: VectorI): Int

    Given a new discrete data vector z, determine which class it belongs to.

    Given a new discrete data vector z, determine which class it belongs to.

    z

    the vector to classify

    Definition Classes
    Classifier
  12. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  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. final def getClass(): java.lang.Class[_]

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

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

    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean

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

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

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

    Definition Classes
    AnyRef
  24. def toString(): String

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

    Train the classifier, i.

    Train the classifier, i.e., calculate statistics and create conditional density (cd) functions. Assumes that conditional densities follow the Normal (Gaussian) distribution.

    Definition Classes
    BayesClassifierClassifier
  26. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Error

Inherited from Classifier

Inherited from AnyRef

Inherited from Any