summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-02-14 11:10:01 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-02-14 11:10:01 +0100
commitdcd2f0ff236173b6bfbf90000e6b47ffd4eb0b90 (patch)
treedfcfcff84a79e7d75c0b0f7062294fd5f99150ed /lib
parent9957a7c1f29c842f31ba7adb2506df021f13388a (diff)
move quality result printout to analyze-archive.py
Diffstat (limited to 'lib')
-rwxr-xr-xlib/dfatool.py22
1 files changed, 5 insertions, 17 deletions
diff --git a/lib/dfatool.py b/lib/dfatool.py
index 3387de0..1699a1d 100755
--- a/lib/dfatool.py
+++ b/lib/dfatool.py
@@ -798,31 +798,19 @@ class EnergyModel:
return self._parameter_names
def assess(self, model_function):
+ results = {}
for name, elem in sorted(self.by_name.items()):
- print('{}:'.format(name))
+ results[name] = {}
if elem['isa'] == 'state':
predicted_data = np.array(list(map(lambda i: model_function(name, 'power', param=elem['param'][i]), range(len(elem['power'])))))
measures = regression_measures(predicted_data, elem['power'])
- if 'smape' in measures:
- print(' power: {:.2f}% / {:.0f} µW'.format(
- measures['smape'], measures['mae']
- ))
- else:
- print(' power: {:.0f} µW'.format(
- measures['mae']
- ))
+ results[name]['power'] = measures
else:
for key in ['duration', 'energy', 'rel_energy_prev', 'rel_energy_next', 'timeout']:
predicted_data = np.array(list(map(lambda i: model_function(name, key, param=elem['param'][i]), range(len(elem[key])))))
measures = regression_measures(predicted_data, elem[key])
- if 'smape' in measures:
- print(' {:15s}: {:.2f}% / {:.0f}'.format(
- key, measures['smape'], measures['mae']
- ))
- else:
- print(' {:15s}: {:.0f}'.format(
- key, measures['mae']
- ))
+ results[name][key] = measures
+ return results