From a700fda050a79a5e9be78f20ac47f9a4fd155c17 Mon Sep 17 00:00:00 2001 From: Ask Hjorth Larsen <asklarsen@gmail.com> Date: Wed, 11 Oct 2017 11:28:48 +0200 Subject: [PATCH] attempt to round displayed numbers --- python-modules/molkrr/krr.py | 2 +- python-modules/molkrr/ml_chemical_space.bkr | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/python-modules/molkrr/krr.py b/python-modules/molkrr/krr.py index f4bf16a..5d14952 100644 --- a/python-modules/molkrr/krr.py +++ b/python-modules/molkrr/krr.py @@ -32,7 +32,7 @@ def timer(name): tstart = time() yield tstop = time() - print('Time {}: {}s'.format(name, tstop - tstart)) + print('Time {}: {:1.3}s'.format(name, tstop - tstart)) def gen_random_index(nsystems, ntestsystems, seed=0): diff --git a/python-modules/molkrr/ml_chemical_space.bkr b/python-modules/molkrr/ml_chemical_space.bkr index 8c96bf0..1432ff4 100644 --- a/python-modules/molkrr/ml_chemical_space.bkr +++ b/python-modules/molkrr/ml_chemical_space.bkr @@ -637,23 +637,23 @@ " //def devi = variance / (ntestsys);", " //y: [min_values.min(), max_values.max()], x: [min_values.min(), max_values.max()],", " ref_pred_plot << new Line(y: [0,10], x: [0,10],", - " displayName:\"Ideal (R=P).\",", - " toolTip: {xs, ys -> \"MAE: \" + mae + \" eV\"});", + " displayName:\"Ideal (R=P).\",", + " toolTip: {xs, ys -> \"MAE: \" + mae.round(3) + \" eV\"});", " ref_pred_plot << new Area(y: [min_values.min() + mae, max_values.max() + mae], ", " x: [min_values.min(), max_values.max()], ", " base: [min_values.min() - mae, max_values.max() - mae], ", " color: new Color(255, 0, 0, 50), ", - " displayName: \"MAE: \" + mae )", + " displayName: \"MAE: \" + mae.rount(3) )", " ref_pred_plot << new Area(y: [min_values.min() + (mae +devi), max_values.max() + (mae+devi)], ", " x: [min_values.min(), max_values.max()], ", " base: [min_values.min() - (mae+devi), max_values.max() - (mae+devi)], ", " color: new Color(255, 0, 0, 50), ", - " displayName: \"Standard deviation: \" + devi)", + " displayName: \"Standard deviation: \" + devi.round(3))", " ref_pred_plot << new Points(x:ref_values, y: prediction,", " color: Color.blue,", " displayName:out_put_label + \" values\",", - " toolTip: {xs, ys, h -> \"real_value = \" + xs + ", - " \", predicted_value = \" + ys + ", + " toolTip: {xs, ys, h -> \"real_value = \" + xs.round(3) + ", + " \", predicted_value = \" + ys.round(3) + ", " \", molecule = \" + ", " outfile_data[h][2]});", "}", -- GitLab