Circular distance measures

User 5281 | 6/12/2016, 1:34:32 PM


I'm new to Graphlab and still trying to familiarize with its features. I have to do a clustering operation on a large dataset, and one of the columns is an 'angle' measure. I would like to have a circular distance measure such that if a=2*pi-0.1 , b=0.1 dist(a,b) =0.2. Is there a way to achieve this ? if there is some non-linear transformation due to a sin/cos function, it is acceptable.
It seems that Graphlab does not support custom distant metrics, but supports mixing the implemented distant metrics? If there is some genius hack to achieve this with the available resources please let me know.

Thanks, Thusitha


User 12 | 6/14/2016, 5:43:10 PM

Hi Thusitha, I think you could compute the angle difference with a custom apply function (off the top of my head, something like (|b - a|+ 2pi) % (2pi)), but you're right that GraphLab doesn't currently allow custom distance functions. I can't think of a great hack to get around this right now - the best I can think of would be to compute and store the pairwise distances on the other features, manually compute the angle differences for each pair, then combine the distances manually. I admit that sounds like a pain, and we do plan to enable custom distances in the future.

Thanks, Brian

User 5281 | 6/21/2016, 2:50:43 PM

Thanks for the comment Brian. I managed to make something up with using cosine distance. It's a hack, but gave me good enough results.