BayesClassifier

scalation.modeling.classifying.BayesClassifier
trait BayesClassifier(k: Int)

The BayesClassifier trait provides methods for Bayesian Classifiers, including calculations of joint probabilities and Conditional Mutual Information (CMI). Make sure the variable values start at zero, otherwise call the shift2zero method. If the value counts (vc) are unknown, the vc_fromData method may be called. Classifier.shift2zero (x) // make sure values for all features start at zero val vc = Classifier.vc_fromData (x) // set value counts from data

Value parameters

k

the number of classes (defaults to binary (2-way) classification

Attributes

See also

bayesClassifierTest for calculating cmi and bayesClassifierTest2 for cmiMatrix

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class TANBayes

Members list

Value members

Concrete methods

def cmi(x: VectorI, z: VectorI, vcxz: VectorI, y: VectorI): Double

Calculate the Conditional Mutual Information (CMI) of data vectors x and z, given response/classification vector y, i.e., I(x; z | y).

Calculate the Conditional Mutual Information (CMI) of data vectors x and z, given response/classification vector y, i.e., I(x; z | y).

Value parameters

vcxz

the vector of value counts (number of distinct values for x, z)

x

the first integer-valued data vector

y

the class vector, where y(i) = class

z

the second integer-valued data vector

Attributes

See also

en.wikipedia.org/wiki/Conditional_mutual_information

Calculate the Conditional Mutual Information (CMI) matrix for data matrix x given response/classification vector y, i.e., I(xj; xl | y) for all pairs of features/columns xj and xl in matrix x.

Calculate the Conditional Mutual Information (CMI) matrix for data matrix x given response/classification vector y, i.e., I(xj; xl | y) for all pairs of features/columns xj and xl in matrix x.

Value parameters

vc

the vector of value counts (number of distinct values per feature)

x

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

y

the class vector, where y(i) = class for row i of the matrix x, x(i)

Attributes

See also

en.wikipedia.org/wiki/Conditional_mutual_information

def jProbXY(x: VectorI, vcx: Int, y: VectorI): MatrixD

Compute the joint probability of x and y and return it as a matrix.

Compute the joint probability of x and y and return it as a matrix.

Value parameters

vcx

the value count for x (number of distinct values for x)

x

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

y

the class vector, where y(i) = class

Attributes

def jProbXZY(x: VectorI, z: VectorI, vcxz: VectorI, y: VectorI): RTensorD

Compute the joint probability of x, z and y and return it as a tensor.

Compute the joint probability of x, z and y and return it as a tensor.

Value parameters

vcxz

the vector of value counts (number of distinct values for x, z)

x

the first integer-valued data vector

y

the class vector, where y(i) = class

z

the second integer-valued data vector

Attributes