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