Log of the unconditional probability density
lp = logP(obj,Xnew)
Discriminant analysis classifier, produced using fitcdiscr.
Matrix where each row represents an observation, and each column represents a predictor. The number of columns in Xnew must equal the number of predictors in obj.
Column vector with the same number of rows as Xnew. Each entry is the logarithm of the unconditional probability density of the corresponding row of Xnew.
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 mean μk and covariance Σk at a point x is
where is the determinant of Σk, and is the inverse matrix.
Construct a discriminant analysis classifier for the Fisher iris data, and examine its prediction for an average measurement.
Load the Fisher 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