weights should be based on a measure of similarity. This is a bit difficult since kNN looks at the euclidean distance and picks neighbors who have the smallest distance. Normally, similarity is defined as 1 - dissimilarity, if dissimilarity is on a 0-1 scale. The euclidean distance doesn't normalize to this scale, so we might try distances / max(distances).
weights should be based on a measure of similarity. This is a bit difficult since kNN looks at the euclidean distance and picks neighbors who have the smallest distance. Normally, similarity is defined as 1 - dissimilarity, if dissimilarity is on a 0-1 scale. The euclidean distance doesn't normalize to this scale, so we might try distances / max(distances).