public void benchmark(int neighboursSize,DistanceMeasure measure){
		long startTime = 0;
		double linearSearchTime = 0;
		double lshSearchTime = 0;
		int numbercorrect = 0;
		int falsePositives = 0;
		int truePositives = 0;
		int falseNegatives = 0;
		//int intersectionSize = 0;
		for(int i = 0 ; i < dataset.size() ; i++){
			Vector query = dataset.get(i);
			startTime = System.currentTimeMillis();
			List<Vector> lshResult = index.query(query,neighboursSize);
			lshSearchTime += System.currentTimeMillis() - startTime;	
			
			startTime = System.currentTimeMillis();
			List<Vector> linearResult = linearSearch(dataset,query,neighboursSize,measure);
			linearSearchTime += System.currentTimeMillis() - startTime;
			
			Set<Vector> set = new HashSet<Vector>();
			set.addAll(lshResult);
			set.addAll(linearResult);
			//intersectionSize += set.size();
			//In the best case, LSH result and linear result contain the exact same elements.
			//The number of false positives is the number of vectors that exceed the number of linear results.
			falsePositives += set.size() - linearResult.size();
			//The number of true positives is Union of results - intersection. 
			truePositives += lshResult.size() + linearResult.size() - set.size();
			//The number of false Negatives the number of vectors that exceed the number of lsh results . 
			falseNegatives =  set.size() - lshResult.size();
							
			//result is only correct if all nearest neighbours are the same (rather strict).
			boolean correct = true;
			for(int j = 0 ; j < Math.min(lshResult.size(),linearResult.size()); j++){
				correct = correct && lshResult.get(j)== linearResult.get(j);
			}
			if(correct){
				numbercorrect++;
			}
		}
		double numberOfqueries = dataset.size();
		double dataSetSize = dataset.size();
		double precision = truePositives / Double.valueOf(truePositives+falsePositives) * 100;
		double recall = truePositives / Double.valueOf(truePositives+falseNegatives) * 100;
		double percentageCorrect = numbercorrect / dataSetSize * 100;
		double percentageTouched = index.getTouched()/numberOfqueries/dataSetSize*100;
		linearSearchTime/=1000.0;
		lshSearchTime/=1000.0;
		int hashes = index.getNumberOfHashes();
		int hashTables = index.getNumberOfHashTables();
		
		//System.out.printf("%10s%15s%10s%10s%10s%10s%10s%10s\n","#hashes","#hashTables","Correct","Touched","linear","lsh","Precision","Recall");
		System.out.printf("%10d%15d%9.2f%%%9.2f%%%9.4fs%9.4fs%9.2f%%%9.2f%%\n",hashes,hashTables,percentageCorrect,percentageTouched,linearSearchTime,lshSearchTime,precision,recall);
	}