void operator()(const utility::VectorBase& distance, const std::vector<size_t>& k_sorted, const Target& target, utility::VectorMutable& prediction) const
For a test sample, this function should calculate a total vote (i.e. based on all k nearest neighbors) for each class. The vector distance contains the distances from a test sample to all training samples. The vector k_sorted contains the indices (for both distance and target) to the k training samples with the smallest distances to the test sample. The class for each training sample is given by target, which is sorted in the same sample order as distance. For each class the function calculates a total vote based on the the nearest neighbors of the test sample that belong to the class. The total vote for each class is stored in the vector prediction. The function should be implemented such that nearest neighbors with distance infinity do not vote.