summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-12-20 12:58:44 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-12-20 12:58:44 +0100
commitb6024d54cb9280db43b7360b799d87b241e6c788 (patch)
tree15b62bc546a800ecdd88fd12af10794ced7ddd27
parent8217e116ddb6e0f1a3095e440e383b8971612416 (diff)
automata: documentation
-rwxr-xr-xlib/automata.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/automata.py b/lib/automata.py
index 8f938bc..2f893e6 100755
--- a/lib/automata.py
+++ b/lib/automata.py
@@ -62,6 +62,21 @@ class SimulationResult:
class PTAAttribute:
+ u"""
+ A single PTA attribute (e.g. power, duration).
+
+ A PTA attribute can be described by a static value and an analytic
+ function (depending on parameters and function arguments).
+
+ It is not specified how value_error and function_error are determined --
+ at the moment, they do not use cross validation.
+
+ :param value: static value, typically in µW/µs/pJ
+ :param value_error: mean absolute error of value (optional)
+ :param function: AnalyticFunction for parameter-aware prediction (optional)
+ :param function_error: mean absolute error of function (optional)
+ """
+
def __init__(self, value: float = 0, function: AnalyticFunction = None, value_error=None, function_error=None):
self.value = value
self.function = function
@@ -74,12 +89,23 @@ class PTAAttribute:
return 'PTAATtribute<{:.0f}, None>'.format(self.value)
def eval(self, param_dict=dict(), args=list()):
+ """
+ Return attribute for given `param_dict` and `args` value.
+
+ Uses `function` if set and usable for the given `param_dict` and
+ `value` otherwise.
+ """
param_list = _dict_to_list(param_dict)
if self.function and self.function.is_predictable(param_list):
return self.function.eval(param_list, args)
return self.value
def eval_mae(self, param_dict=dict(), args=list()):
+ """
+ Return attribute mean absolute error for given `param_dict` and `args` value.
+
+ Uses `function_error` if `function` is set and usable for the given `param_dict` and `value_error` otherwise.
+ """
param_list = _dict_to_list(param_dict)
if self.function and self.function.is_predictable(param_list):
return self.function_error['mae']