Open barendgehrels opened 1 year ago
Indeed, there are places in the bibliography where Hausdorff distance is defined oriented or assymetric $h(A,B) = max{a\in A}(min{b\in B}(d(a,b))$ where $d(a,b)$ is the distance between $a$ and $b$. But maybe the most common is the symmetric one i.e. $H(A,B)=max( h(A,B),h(B,A ))$ (the one you call "fixed").
Thus, it is not exactly wrong, it is a matter of definition. However, it is problematic the definition is not given in the documentation.
I am OK to implement the symmetric Hausdorff and also describe it in the documentation. I am also OK if we keep the assymetric explicitly say this in the documentation and let the user decide whether to use the symmetric one by writing a function as your fixed_hausdorff()
.
hi @vissarion ,
All right, it makes sense so we don't need to change the implementation. But we should add it to the documentation, so I can leave this ticket open.
I will rename fixed_hausdorff
later in my own PR to, for example, symmetric_hausdorff
.
Thanks.
The Hausdorff algorithm is not symmetrical and can give unexpected results.
SEE COMMENTS BELOW - we should fix the documentation.
Minimal case:
It reports:
and you can see it is wrong. I verified it with another (non open source) version of Hausdorff and that gives the same result as here labeled as
Fixed
(also for other testcases).The
fixed_hausdorff
presented here is probably not optimized. I only tested for linestrings.The correct version is equal to Frechet, for these testcases (for others, obviously, it's not).