kNN (or other distance-based classifier) with columns requiring different, custom similarity measures

I have a reference geolocation data consisting of longitude, latitude and azimuth, which I want to use to classify other runs. Longitude and latitude are not a problem, but azimuth is, as it is an angular measure, which requires a specific distance/similarity measure (e.g. 359° and 1° are just 1° apart, so in reality, they are “similar” headings, but according to Euclidean distance, they are as far from each other, as they could be). In other words, I need to be able to associate a custom similarity measure with one of the parameters (columns), but I want to use it for classification (like k-NN), not clustering. I’d like to measure longitude and latitude similarity, by means of Euclidean distance, and azimuth as a normalized absolute angle difference. Actually, in this example, they are all angular measures, and all could be measured in the same way.

Hello @torczyk

I tried to build an example workflow that will help you to calculate the degree difference. Although the degree difference is calculated using direction info as well eg, clockwise or anticlockwise. I decided to use an absolute measure to calculate this difference between 0-180 degrees.

let me know if this will be helpful.

Degree Difference Calculation.knwf (16.1 KB)

1 Like

Thank you for your answer. I know the formula for the absolute angle difference, but I’m not sure how to use it in conjunction with a k-NN, as a similarity measure.

This is basically a problem with calculating a distance in any “wrapped” space.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.