upd knn, optional to select knn by type