def __init__(self, N, vectors, coverage_ratio=<NUM_LIT>):
<EOL>self.vector_dict = {}<EOL>self.N = N<EOL>self.coverage_ratio = coverage_ratio<EOL>self.vectors = numpy_array_from_list_or_numpy_array(vectors)<EOL>for index in range(self.vectors.shape[<NUM_LIT:1>]):<EOL><INDENT>self.vector_dict[self.__vector_to_string(<EOL>self.vectors[:, index])] = index<EOL><DEDENT>vectors_t = numpy.transpose(self.vectors)<EOL>query_count = numpy.floor(self.coverage_ratio *<EOL>self.vectors.shape[<NUM_LIT:1>])<EOL>self.query_indices = []<EOL>for k in range(int(query_count)):<EOL><INDENT>index = numpy.floor(k*(self.vectors.shape[<NUM_LIT:1>]/query_count))<EOL>index = min(index, self.vectors.shape[<NUM_LIT:1>]-<NUM_LIT:1>)<EOL>self.query_indices.append(int(index))<EOL><DEDENT>print('<STR_LIT>' % query_count)<EOL>self.nearest_radius = {}<EOL>self.exact_search_time_per_vector = <NUM_LIT:0.0><EOL>for index in self.query_indices:<EOL><INDENT>v = vectors_t[index, :].reshape(<NUM_LIT:1>, self.vectors.shape[<NUM_LIT:0>])<EOL>exact_search_start_time = time.time()<EOL>D = cdist(v, vectors_t, '<STR_LIT>')<EOL>self.nearest_radius[index] = scipy.sort(D)[<NUM_LIT:0>, N]<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.