📄 gmm_distance_bhattacharyya.m
字号:
function [Bc,Bd] = gmm_distance_bhattacharyya(g1, g2, N)
% Monte Carlo approximation of Bhattacharyya distance.
%
% Note: MC integration of the form: integral of p(x)f(x) dx
% require that p(x) is normalised -- that its integral is 1.
% In this form, the Bhattacharyya integral is
%
% sqrt(a(x)*b(x)) = a(x)*sqrt(a(x)*b(x))/a(x)
%
% So that we have p(x) = a(x) and f(x) = sqrt(a(x)*b(x))/a(x)
s = gmm_samples(g1, N); % use g1 as proposal (ie, as a(x))
w1 = gmm_evaluate(g1, s);
w2 = gmm_evaluate(g2, s);
Bc = sum(sqrt(w1.*w2)./w1) / N; % Bhattacharyya coefficient
Bd = -log(Bc);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -