KNN classifier with kd-tree