Here you can find the source of saveMeasures(String appDirPath, String fileName, double[] measures)
public static void saveMeasures(String appDirPath, String fileName, double[] measures)
//package com.java2s; //License from project: Apache License import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class Main { public static void saveMeasures(String appDirPath, String fileName, double[] measures) { String filePath = appDirPath + File.separator + fileName; PrintWriter pw = null;//from w w w .jav a2s.c o m boolean autoFlush = true; try { pw = new PrintWriter(new BufferedWriter(new FileWriter(filePath)), autoFlush); } catch (IOException e) { e.printStackTrace(); exit(1); } double RMSE = measures[0]; double MAP = measures[1]; double MRR = measures[2]; double MP10 = measures[3]; pw.printf("RMSE: %.8g\n", RMSE); pw.printf("MAP: %.8g\n", MAP); pw.printf("MRR: %.8g\n", MRR); pw.printf("MP@10: %.8g\n", MP10); pw.close(); } public static void exit(int status) { System.exit(status); } }