def __init__(self, N, vectors, coverage_ratio=<NUM_LIT>):
<EOL>self.vector_dict = {}<EOL>self.N = N<EOL>self.coverage_ratio = coverage_ratio<EOL>numpy_vectors = numpy_array_from_list_or_numpy_array(vectors)<EOL>self.vectors = numpy.vstack([unitvec(v) for v in numpy_vectors.T])<EOL>for index, v in enumerate(self.vectors):<EOL><INDENT>self.vector_dict[self.__vector_to_string(v)] = index<EOL><DEDENT>query_count = numpy.floor(self.coverage_ratio *<EOL>len(self.vectors))<EOL>self.query_indices = []<EOL>for k in range(int(query_count)):<EOL><INDENT>index = numpy.floor(k * (float(len(self.vectors)) / query_count))<EOL>index = min(index, len(self.vectors) - <NUM_LIT:1>)<EOL>self.query_indices.append(int(index))<EOL><DEDENT>print('<STR_LIT>' % query_count)<EOL>self.closest = {}<EOL>self.exact_search_time_per_vector = <NUM_LIT:0.0><EOL>for index in self.query_indices:<EOL><INDENT>v = self.vectors[index, numpy.newaxis]<EOL>exact_search_start_time = time.time()<EOL>D = cdist(v, self.vectors, '<STR_LIT>')<EOL>self.closest[index] = scipy.argsort(D)[<NUM_LIT:0>, <NUM_LIT:1>:N+<NUM_LIT:1>]<EOL>exact_search_time = time.time() - exact_search_start_time<EOL>self.exact_search_time_per_vector += exact_search_time<EOL><DEDENT>print('<STR_LIT>')<EOL>self.exact_search_time_per_vector /= float(len(self.query_indices))<EOL>
Performs exact nearest neighbour search on the data set.

vectors can either be a numpy matrix with all the vectors
as columns OR a python array containing the individual
numpy vectors.