χ二乗距離 カイ二乗距離 chi square kernel (distance)

意外と見つからないのでメモ。
x^2 statistic measuresの部分でいいのでは(英語)?
http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/SHAHROKNI1/node8.html


具体例ならこちら(日本語)。
http://miku.motion.ne.jp/stories/11_TFkai.html

f:id:peroon:20100212151959p:image

matlab, octaveで定義してみました。

function d=chi_square(v1, v2)

%chi square distance
%input : column vector pair
%return : distance

mean_v=(v1+v2)/2;
diff_v=v1-mean_v;
squ_v =diff_v.*diff_v;
temp  =squ_v./mean_v;

d=sum(temp);