Chi-square distance formula

Considering I'm using euclidean distance to calculate the distance between two vector.
cosined=sqrt(sum(abs((a-b).^2)))
Now I want to change euclidean into chi-square distance, does anyone know how to calculate chi-square distance between two vectors?

2 件のコメント

Manolis Michailidis
Manolis Michailidis 2015 年 9 月 18 日
Js Goh
Js Goh 2015 年 9 月 18 日
tested, not working

サインインしてコメントする。

回答 (1 件)

the cyclist
the cyclist 2015 年 9 月 18 日

0 投票

I found this page after googling for about 30 seconds: http://www.cs.columbia.edu/~mmerler/project/code/pdist2.m

6 件のコメント

Js Goh
Js Goh 2015 年 9 月 18 日
i found this too but I don't know how to modify it w/o the loop.
Sry I'm too new to matlab, still learning.
Manolis Michailidis
Manolis Michailidis 2015 年 9 月 18 日
i recommend you first use it as it is with thhe loop to see if you get the expected results
Js Goh
Js Goh 2015 年 9 月 18 日
I tried, it doesn't come out with the expected results.
the cyclist
the cyclist 2015 年 9 月 18 日
I don't understand what you about the loop. I just put that function in a directory, then did
pdist2([1 2 3],[4 5 6],'chisq')
and got a result. What more do you need?
AJAY KUMAR SAHU
AJAY KUMAR SAHU 2019 年 5 月 31 日
Hey, It doesn't work!!
the cyclist
the cyclist 2019 年 5 月 31 日
MATLAB has a built-in pdist2 function, which you are presumably calling (rather than the one from the link listed above). You have two options:
  • Download the function from the link above, and use it
  • Use the built-in MATLAB function, which has the ability to define a custom distance function, and code the chi-square distance yourself.

サインインしてコメントする。

質問済み:

2015 年 9 月 18 日

コメント済み:

2019 年 5 月 31 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by