diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2021-07-12 16:10:29 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2021-07-12 16:10:29 +0200 |
commit | fadfb6c5203a3fb048786a2c1e494b7cc46496e8 (patch) | |
tree | 07059262a4c277a84838640cd76edc426783057e /lib | |
parent | f4bb2af96fe0923258b1a082ecba06da7b88df67 (diff) |
ModelAttribute, SplitFunction: Fix from_json methods
Diffstat (limited to 'lib')
-rw-r--r-- | lib/functions.py | 2 | ||||
-rw-r--r-- | lib/parameters.py | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/functions.py b/lib/functions.py index 78dfab8..86025dc 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -331,6 +331,8 @@ class SplitFunction(ModelFunction): for k, v in data["child"].items(): self.child[k] = ModelFunction.from_json(v) + return self + def __repr__(self): return f"SplitFunction<{self.value}, param_index={self.param_index}>" diff --git a/lib/parameters.py b/lib/parameters.py index 1f6f8e3..41153a2 100644 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -504,8 +504,12 @@ class ModelAttribute: self.ignore_param = dict() # Static model used as lower bound of model accuracy - self.mean = np.mean(data) - self.median = np.median(data) + if data is not None: + self.mean = np.mean(data) + self.median = np.median(data) + else: + self.mean = None + self.median = None # LUT model used as upper bound of model accuracy self.by_param = None # set via ParallelParamStats @@ -540,7 +544,7 @@ class ModelAttribute: def webconf_function_map(self): return self.model_function.webconf_function_map() - @staticmethod + @classmethod def from_json(cls, name, attr, data): param_names = data["paramNames"] arg_count = data["argCount"] |