private DistanceResult findNearestCluster(double[] position) 
			throws ClusterException {

		DistanceResult res= new DistanceResult();
		for(int i= 0; i< this.clusterNumber; ++i) {
			
			double[] centroid= this.clusterList.get(i).getCentroid();
			double similarity= this.cosineSimilarity(position, centroid);

			if(res.getSimilarity() == -2.0 || similarity > res.getSimilarity()) {
				res.setSimilarity(similarity);
				res.setCluster(i);
			}
		}
		
		if (res.getCluster() == -1)
			throw new ClusterException("Can't assign to any cluster");
	
		return res;
	}