# How can I change the distance function in Classify when using NearestNeighbor?

Issue not present in version "10.4.1 for Linux x86 (64-bit) (April 11, 2016)"

trainingset = {"A" -> 1, "B" -> 4, "C" -> 6};
classifier =
Classify[trainingset,
Method -> {"NearestNeighbors", "NeighborsNumber" -> 5,
"DistanceFunction" -> CosineDistance}]


I'm getting the message

Unknown option "DistanceFunction" in Classify

However, when I evaluate

ClassifierInformation[classifier, "Properties"]


I see "DistanceFunction" in the list of properties returned.

I see the same thing in the OpenCV toolbox. In KnearestNeighbors function, I can not change the DistanceFunction despite Euclidean distance not being the best choice, specially with big data.

• It seems that is a bug in the Classify function – BetterEnglish Jan 15 '16 at 22:20