public static void main(String[] args) {
		String datamodel = args[0];
		String testfile = args[1];
		String predictionsOutput = args[2];

		DataModel model = null;

		try {
			model = new FileDataModel(new File(datamodel));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return;
		}

		ItemSimilarity similarityLogLiklyhood = new LogLikelihoodSimilarity(
				model);

		Recommender recommender = new GenericItemBasedRecommender(model,
				similarityLogLiklyhood);

		Writer writer = null;

		try {
			writer = new BufferedWriter(new OutputStreamWriter(
					new FileOutputStream(predictionsOutput), "utf-8"));

			ArrayList<Rating> testset = getTestSet(testfile);

			float s = 0;
			int count = 0;
			for (Rating r : testset) {
				float predictedScore = 0;
				try {
					predictedScore = recommender.estimatePreference(r.user,
							r.item);
				} catch (Exception e) {
					// TODO: handle exception
					continue;
				}

				if (Float.compare(Float.NaN, predictedScore) != 0) {
					s = s + (predictedScore - r.rating)
							* (predictedScore - r.rating);
					// System.out.println(r.rating + "\t" + predictedScore
					// + "\t" + s);
					count++;
				} else {
					// System.out.println("NaN");
				}
				writer.write(r.user + "," + r.item + "," + predictedScore
						+ "\n");
				writer.flush();
			}
			System.out.println("Num of non NaN ratings = " + count + "\n");
			System.out.println("Tot Num of ratings = " + testset.size() + "\n");
			System.out.println("RMSE = " + Math.sqrt(s / count) + "\n");
			writer.close();
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}