taki0112 / Vector_Similarity

Python, Java implementation of TS-SS called from "A Hybrid Geometric Approach for Measuring Similarity Level Among Documents and Document Clustering"
MIT License
295 stars 44 forks source link

angle Theta converted 2x to radian #9

Open ClemensKohl opened 1 year ago

ClemensKohl commented 1 year ago

Hi,

thanks a lot for the great implementation of TS-SS! I noticed that in your as well as all other implementations I have found, the angle theta is converted to radians, although it already is in radian.

See the following line here: https://github.com/taki0112/Vector_Similarity/blob/3a1f6248aba6be8eed865339a26e800dcf02c028/python/TS_SS/Vector_Similarity.py#L20C1-L20C43

Is there a reason for this conversion? As far as I can tell Theta() outputs the angle in radian (as also demonstrated by the fact that we add math.radian(10) to the acos).

Similarly, the area of the sector is calculated with the formula for the angle in degrees, but again, as far as I can tell Theta is in radian.

Thanks a lot in advance! Clemens

mhlinder commented 8 months ago

Additionally, theta is normalized by 360 -- however, I believe this should be 2*pi (?), since theta is in radians

An R implementation uses the correct factor: https://github.com/jlmelville/rnndescent/blob/master/inst/include/tdoann/distance.h#L576