An adaptive k-nearest neighbor algorithm | Synapse