    001package javax.visrec.ml.eval;
    002
    003import java.util.HashMap;
    004
    005/**
    006 * This class holds information about various classification performance measures.
    007 *
    008 * @author Zoran Sevarac
    009 * @since 1.0
    010 */
    011public class PerformanceMeasure {
    012    public final static String MSE          = "MSE";
    013    public final static String ACCURACY     = "Accuracy";
    014    public final static String PRECISION    = "Precision";
    015    public final static String RECALL       = "Recall";
    016    public final static String F1SCORE      = "F1Score";
    017
    018    private final HashMap<String, Float> values = new HashMap<>();
    019
    020    public float get(String key) {
    021        return values.get(key);
    022    }
    023
    024    public void set(String key, float value) {
    025        values.put(key, value);
    026    }
    027
    028    @Override
    029    public String toString() {
    030        StringBuilder sb = new StringBuilder();
    031        values.entrySet().stream().forEach((e) ->  sb.append(e.getKey() + ": "+e.getValue() + System.lineSeparator()) );
    032
    033        return sb.toString();
    034    }
    035
    036}