function sim = model_match_models(model1, model2) % sim = model_match_models(model1, model2) % Return a distance between two models % 2007-04-30 dpwe@ee.columbia.edu if (model1.nmix > 1) | (model2.nmix > 2) error('model_match_models only for single gauss at present'); else % KL distance between single Gausses dmean = model1.mean - model2.mean; ndim = length(dmean); kl2 = dmean'*(model1.invsigma + model2.invsigma)*dmean ... + trace(model1.sigma*model2.invsigma + model2.sigma*model1.invsigma) ... - 2*ndim; % make it larger = more similar, KL = 0 -> sim = 1 sim = 1/(1+kl2); end