Log unconditional probability density for discriminant analysis classifier
lp = logp(obj,Xnew)
returns the log of the unconditional probability density of each row of
lp = logp(
Xnew, computed using the discriminant analysis model
Discriminant analysis classifier, produced using
Matrix where each row represents an observation, and each column
represents a predictor. The number of columns in
Column vector with the same number of rows as
Compute Log Unconditional Probability Density of an Observation
Construct a discriminant analysis classifier for Fisher's iris data, and examine its prediction for an average measurement.
Load Fisher's iris data and construct a default discriminant analysis classifier.
load fisheriris Mdl = fitcdiscr(meas,species);
Find the log probability of the discriminant model applied to an average iris.
logpAverage = logp(Mdl,mean(meas))
logpAverage = -1.7254
Unconditional Probability Density
The unconditional probability density of a point x of a discriminant analysis model is
where P(x,k) is the conditional density of the model at x for class k, when the total number of classes is K.
The conditional density P(x,k) is
P(x,k) = P(k)P(x|k),
where P(k) is the prior probability of class k, and P(x|k) is the conditional density of x given class k. The conditional density function of the multivariate normal with 1-by-d mean μk and d-by-d covariance Σk at a 1-by-d point x is
where is the determinant of Σk, and is the inverse matrix.