Global similarity functions for the KNN method