@Override
	public double predict(int userID, int movieID) {

		double rating = 0;
		ArrayList<Double> sim = new ArrayList<Double>();
		ArrayList<Double> rat = new ArrayList<Double>();
		ArrayList<Double> avg = new ArrayList<Double>();

		HashMap<Integer, Double> tempHashMap = similarities.get(movieID);
		if (tempHashMap == null) {
			// return average if the movie wasn't in the training set
			return average;
		}

		// fill the Arrays with the according data
		for (Map.Entry<Integer, Double> entry : tempHashMap.entrySet()) {

			if (userMovieRatings.get(userID).get(entry.getKey()) == null) {
			} else {
				sim.add(entry.getValue());
				rat.add(userMovieRatings.get(userID).get(entry.getKey()));
				avg.add(averageRatings.get(entry.getKey()));
			}
		}

		// Calculate rating according to the defined metric
		if (pMetric.toLowerCase().equals("weightedsum")) {
			rating = PredictionCalculator.calculateWeightedSum(sim, rat);

		} else if (pMetric.toLowerCase().equals("adjustedsum")) {
			rating = PredictionCalculator.calculateAdjustedSum(averageRatings.get(movieID), avg, rat);

		} else if (pMetric.toLowerCase().equals("adjustedweightedsum")) {
			rating = PredictionCalculator.calculateAdjustedWeightedSum(averageRatings.get(movieID), avg, rat, sim);
		}

		// if rating is zero, use the averageRatings since this is for sure more
		// accurate than zero
		if (rating == 0)
			return averageRatings.get(movieID);

		return rating;
	}