WIP: Support for distance matrices in NearestNeighbor

Support for NearestNeighbor (the unsupervised one) to handle being given a distance matrix (i.e. a matrix D such that D[i][j] is the distance between samples i and j).