CompactClassificationNaiveBayes
statistics: CompactClassificationNaiveBayes
Compact naive Bayes classification
A CompactClassificationNaiveBayes object carries the fitted
densities of a ClassificationNaiveBayes model and everything
predict needs, but not the observations the model was fitted on.
It classifies new data identically to the model it came from, and is far
smaller to keep or to ship.
Create one with the compact method of a
ClassificationNaiveBayes object. Because it holds no training
data, it has no resub methods and cannot be cross-validated.
See also: ClassificationNaiveBayes, fitcnb
Source Code: CompactClassificationNaiveBayes
The CompactClassificationNaiveBayes class contains the following properties:
A cell array of character vectors with one entry per predictor, naming the distribution fitted to it. This property is read-only.
The means used to center the predictors, when the model standardizes them, and empty otherwise. This property is read-only.
The standard deviations used to scale the predictors, when the model standardizes them, and empty otherwise. This property is read-only.
A cell array with one row per class and one column per predictor, holding the parameters fitted to each. This property is read-only.
A cell array with one entry per predictor, holding the distinct levels of each categorical predictor and empty for every other. This property is read-only.
A cell array naming the smoothing kernel of each kernel predictor, and empty for every other. This property is read-only.
A cell array giving the support of each kernel predictor’s density, and empty for every other. This property is read-only.
A numeric matrix with one row per class and one column per predictor, and empty when no predictor uses a kernel density. This property is read-only.
The distinct classes the model was fitted on, in the order the other per-class properties use. This property is read-only.
A numeric row vector with one entry per class, in the order of
ClassNames, summing to one.
A square numeric matrix where Cost(i,j) is the cost of
classifying an observation of class into class .
A character vector naming the function applied to the posterior
returned by predict, or a function handle.
A cell array of character vectors naming the predictors. This property is read-only.
The column indices treated as categorical, or empty when none is. This property is read-only.
A character vector naming the response variable. This property is read-only.
A cell array of character vectors naming the predictors as the model sees them. This property is read-only.
The CompactClassificationNaiveBayes class offers the following public methods:
CompactClassificationNaiveBayes: obj = CompactClassificationNaiveBayes (Mdl)
Mdl is the ClassificationNaiveBayes object to compact. The
documented way to reach this constructor is the compact method.
See also: ClassificationNaiveBayes
CompactClassificationNaiveBayes: label = predict (obj, XC)
CompactClassificationNaiveBayes: [label, score, cost] = predict (obj, XC)
The same classification the model it came from would give: the label of least expected cost, the posterior of each class, and the expected misclassification cost of each.
CompactClassificationNaiveBayes: m = margin (obj, X, Y)
CompactClassificationNaiveBayes: e = edge (obj, X, Y)
CompactClassificationNaiveBayes: e = edge (…, 'Weights', w)
CompactClassificationNaiveBayes: l = loss (obj, X, Y)
CompactClassificationNaiveBayes: l = loss (…, name, value)
Takes the 'LossFun' and 'Weights' options that
ClassificationNaiveBayes.loss takes.
CompactClassificationNaiveBayes: lp = logp (obj, X)
CompactClassificationNaiveBayes: savemodel (obj, filename)
savemodel (obj, filename) saves each property of a
CompactClassificationNaiveBayes object into an Octave binary file, the
name of which is specified in filename, along with an extra
variable, which defines the type classification object these variables
constitute. Use loadmodel in order to load a classification
object into Octave’s workspace.
See also: loadmodel, fitcnb, CompactClassificationNaiveBayes