public Object[] classifyKNN(I_InputPattern p)
    {
	Neuron winner = map.getWinningNeuron(p.getData());
	Point coord = new Point(winner.X,winner.Y);

	// Stores the nearest neighbours.
	Vector<Neighbour> neighbours = new Vector<Neighbour>();

	// Calculate distances to neighbours
	for(int i = 0; i < positiveCoords.size();i++)
	{
	    double distance = distanceBetweenPoints(coord.x,coord.y,positiveCoords.get(i).x,positiveCoords.get(i).y);
	    neighbours.add(new Neighbour(distance, Constants.PULSAR));
	}

	for(int i = 0; i < negativeCoords.size();i++)
	{
	    double distance = distanceBetweenPoints(coord.x,coord.y,negativeCoords.get(i).x,negativeCoords.get(i).y);
	    neighbours.add(new Neighbour(distance, Constants.RFI));
	}

	// Sort the neighbours such that element zero has the smallest distance.
	Collections.sort(neighbours);

	/*
	for(int i =0; i < neighbours.size();i++)
	{
	    System.out.println("Neighbour: "+ i + " "+ neighbours.elementAt(i).toString());
	}*/ // Debugging purposes

	// Next we want to find the K-nearest neighbours. We search the list of
	// potential neighbours for those top K unique neighbours. In the case of
	// two neighbours with the same distance, these will both be retained.
	int k_count =0;
	Vector<Neighbour> k_nearest_neighbours = new Vector<Neighbour>();

	for(int i =0; i < neighbours.size();i++)
	{
	    // if the distance measure found is unique
	    if(!k_nearest_neighbours.contains(neighbours.elementAt(i)))
	    {
		// increment count of K unique neighbours found.
		k_count++;

		if(k_count > this.K)// if we have more than K unique examples found
		    break;// break the loop

		// else add the new unique neighbour
		k_nearest_neighbours.add(neighbours.elementAt(i));		
	    }
	    else // the neighbour is not unique, but repeated
		k_nearest_neighbours.add(neighbours.elementAt(i));// still keep the neighbour for majority voting 

	}

	// do some explicit house keeping
	// for no other reason other than it makes me feel better :D
	neighbours.clear();
	neighbours = null;

	double positive_weight = 0.0;// the weighting towards a positive classification
	double negative_weight = 0.0;// the weighting towards a negative classification

	/*
	for(int i =0; i < k_nearest_neighbours.size();i++)
	{
	    System.out.println("Nearest Neighbour: "+ i + " "+ k_nearest_neighbours.elementAt(i).toString());
	}*/ // Debugging purposes

	// For each of the nearest neighbours found
	for(int i =0; i < k_nearest_neighbours.size();i++)
	{
	    // Update the weights.
	    if(k_nearest_neighbours.elementAt(i).getClassification().equals(Constants.PULSAR))
	    {
		double distance = k_nearest_neighbours.elementAt(i).getDistance();

		if(Double.compare(distance, 0.0)==0)
		    positive_weight = positive_weight +1;
		else
		    positive_weight = positive_weight + (double)(1.0/distance);
	    }
	    else
	    {
		double distance = k_nearest_neighbours.elementAt(i).getDistance();

		if(Double.compare(distance, 0.0)==0)
		    negative_weight = negative_weight +1;
		else
		    negative_weight = negative_weight + (double)(1.0/distance);
	    }
	}

	/*
	try
	{
	    System.out.println("Positive Weight: "+positive_weight + " Negative Weight: "+negative_weight);

	    if(Double.compare(positive_weight, negative_weight) < 0) // positive weight less than negative weight.
		System.out.println("Class: "+Constants.RFI);
	    else if(Double.compare(positive_weight, negative_weight) == 0) // positive weight equal to negative weight, favour positive
		System.out.println("Class: "+Constants.PULSAR);
	    else // positive weight greater than negative weight
		System.out.println("Class: "+Constants.PULSAR);
	    System.in.read();
	}
	catch (IOException e)
	{
	    e.printStackTrace();
	}*/ //Debugging Purposes

	// Now compare the weights. Whichever is greater decides the classification label
	// in the case of a tie, positive classification is favoured, as we don't want to throw away
	// any potential positive examples.
	if(Double.compare(positive_weight, negative_weight) < 0) // positive weight less than negative weight.
	    return new Object[]{ Constants.RFI, coord };
	else if(Double.compare(positive_weight, negative_weight) == 0) // positive weight equal to negative weight, favour positive
	    return new Object[]{Constants.PULSAR,coord};
	else // positive weight greater than negative weight
	    return new Object[]{Constants.PULSAR,coord};
    }