scalation.analytics

NaiveBayesR

Related Doc: package analytics

class NaiveBayesR extends ClassifierReal

The NaiveBayesR class implements a Gaussian Naive Bayes Classifier, which is the most commonly used such classifier for continuous 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 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
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. NaiveBayesR
  2. ClassifierReal
  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 NaiveBayesR(x: MatrixD, y: VectorI, fn: Array[String], k: Int, cn: Array[String])

    x

    the real-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

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

  6. def calcStats(): Unit

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

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

  8. def classify(z: VectorD): (Int, String)

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

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

    Given a new discrete (integer-valued) data vector 'z', determine which class it belongs to, by first converting it to a vector of doubles.

    Given a new discrete (integer-valued) data vector 'z', determine which class it belongs to, by first converting it to a vector of doubles.

    z

    the vector to classify

    Definition Classes
    ClassifierRealClassifier
  10. def clone(): AnyRef

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

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

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

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

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

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

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

    the training-set size as a Double

    the training-set size as a Double

    Attributes
    protected
    Definition Classes
    ClassifierReal
  20. val n: Int

    the number of features/variables (# columns)

    the number of features/variables (# columns)

    Attributes
    protected
    Definition Classes
    ClassifierReal
  21. val nd: Double

    the feature-set size as a Double

    the feature-set size as a Double

    Attributes
    protected
    Definition Classes
    ClassifierReal
  22. final def ne(arg0: AnyRef): Boolean

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

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

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

    Definition Classes
    AnyRef
  26. def test(xx: MatrixD, 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 real-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
    ClassifierReal
  27. def toString(): String

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

    Train the classifier, i.e., calculate statistics and create conditional density (cd) functions.

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

    Definition Classes
    NaiveBayesRClassifier
  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 ClassifierReal

Inherited from Error

Inherited from Classifier

Inherited from AnyRef

Inherited from Any

Ungrouped