class KnnClassifier implements Classifier<KnnModel> {

	@Override
	public CategoryEntries classify(FeatureVector featureVector, KnnModel model) {

		// initialize with all category names and a score of zero
		CategoryEntriesBuilder builder = new CategoryEntriesBuilder().set(model.getCategories(), 0);

		double[] numericVector = model.getNormalizedVectorForClassification(featureVector);

		// find k nearest neighbors, compare instance to every known instance
		FixedSizePriorityQueue<Pair<String, Double>> neighbors = new FixedSizePriorityQueue<>(k,
				new EntryValueComparator<Double>(Order.DESCENDING));

		for (TrainingExample example : model.getTrainingExamples()) {
			double distance = example.distance(numericVector);
			neighbors.add(Pair.of(example.category, distance));
		}

		for (Pair<String, Double> neighbor : neighbors.asList()) {
			double distance = neighbor.getValue();
			double weight = 1.0 / (distance + 0.000000001);
			String targetClass = neighbor.getKey();
			builder.add(targetClass, weight);
		}

		return builder.create();
	}

	public  KnnClassifier(int k);
	public  KnnClassifier();

}