<commit_before>package edu.ntnu.idi.goldfish;

import java.util.List;

public class Result {

	Evaluation evaluation;
	
	// RMSE
	double RMSE;
	
	// AAD/MAE 
	double AAD;
	
	// IR stats (precision, recall)
	double precision;
	double recall;
	
	// model build timing
	long buildTime;
	
	// recommendation timing
	long recTime;
	
	public Result(Evaluation evaluation, double RMSE, double AAD, double precision, double recall, long buildTime, long recTime) {
		this.evaluation = evaluation;

		this.RMSE = RMSE;
		this.AAD = AAD;
		
		this.precision = precision;
		this.recall = recall;
		
		this.buildTime = buildTime;
		this.recTime = recTime;
	}
	
	public int getTopN() {
		return evaluation.getTopN();
	}
	
	public double getKTL() {
		return evaluation.getKTL();
	}
	
	public String getSimilarity() {
		return evaluation instanceof MemoryBased ? ((MemoryBased) evaluation).similarity.toString() : "";
	}
	
	public String toString() {
		
		Formatter formats = new Formatter();
		formats.put("%-11s", evaluation.toString());
		formats.put("%19s", getSimilarity());
		formats.put("K/T/L: %5.2f", getKTL());
		formats.put("Top-N: %3d", getTopN());
		formats.put("RMSE: %6.3f", RMSE);
//		formats.put("AAD: %6.3f", AAD);
		formats.put("Precision: %6.3f", precision);
		formats.put("Recall: %6.3f", recall);
		formats.put("Build time: %4d", buildTime);
		formats.put("Rec time: %2d", recTime);

		return formats.join(" | ");
	}
	
	public String toCSV() {
		Formatter formats = new Formatter();
		formats.put("%s", evaluation.toString());
		formats.put("%s", getSimilarity());
		formats.put("%.2f", getKTL());
		formats.put("%d", getTopN());
//		formats.put("%.3f", RMSE);
//		formats.put("%.3f", AAD);
		formats.put("%.3f", precision);
		formats.put("%.3f", recall);
		formats.put("%d", buildTime);
		formats.put("%d", recTime);
		
		return formats.join(",");
	}
	<commit_msg>Enable RMSE output when printing to file.<commit_after>package edu.ntnu.idi.goldfish;

import java.util.List;

public class Result {

	Evaluation evaluation;
	
	// RMSE
	double RMSE;
	
	// AAD/MAE 
	double AAD;
	
	// IR stats (precision, recall)
	double precision;
	double recall;
	
	// model build timing
	long buildTime;
	
	// recommendation timing
	long recTime;
	
	public Result(Evaluation evaluation, double RMSE, double AAD, double precision, double recall, long buildTime, long recTime) {
		this.evaluation = evaluation;

		this.RMSE = RMSE;
		this.AAD = AAD;
		
		this.precision = precision;
		this.recall = recall;
		
		this.buildTime = buildTime;
		this.recTime = recTime;
	}
	
	public int getTopN() {
		return evaluation.getTopN();
	}
	
	public double getKTL() {
		return evaluation.getKTL();
	}
	
	public String getSimilarity() {
		return evaluation instanceof MemoryBased ? ((MemoryBased) evaluation).similarity.toString() : "";
	}
	
	public String toString() {
		
		Formatter formats = new Formatter();
		formats.put("%-11s", evaluation.toString());
		formats.put("%19s", getSimilarity());
		formats.put("K/T/L: %5.2f", getKTL());
		formats.put("Top-N: %3d", getTopN());
		formats.put("RMSE: %6.3f", RMSE);
//		formats.put("AAD: %6.3f", AAD);
		formats.put("Precision: %6.3f", precision);
		formats.put("Recall: %6.3f", recall);
		formats.put("Build time: %4d", buildTime);
		formats.put("Rec time: %2d", recTime);

		return formats.join(" | ");
	}
	
	public String toCSV() {
		Formatter formats = new Formatter();
		formats.put("%s", evaluation.toString());
		formats.put("%s", getSimilarity());
		formats.put("%.2f", getKTL());
		formats.put("%d", getTopN());
		formats.put("%.3f", RMSE);
//		formats.put("%.3f", AAD);
		formats.put("%.3f", precision);
		formats.put("%.3f", recall);
		formats.put("%d", buildTime);
		formats.put("%d", recTime);
		
		return formats.join(",");
	}
	
{'fraction_non_alphanumeric': 0.17595541401273884, 'fraction_numerical': 0.01167728237791932, 'mean_word_length': 3.8695090439276485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6255253', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1324, 'n_words': 302}