diff options
| author | pepperpepperpepper <pepper@scannerjammer.com> | 2015-12-06 23:16:09 -0800 |
|---|---|---|
| committer | pepperpepperpepper <pepper@scannerjammer.com> | 2015-12-06 23:16:09 -0800 |
| commit | f38100a74f0d88cafeac8fb4c8fb99241007da08 (patch) | |
| tree | 7bb1278dcc4243da0bac167e800c340f4ecf1495 /ricky/params.py | |
| parent | f72d7dc6a5a926f56790151e3dde36eaf7978ba0 (diff) | |
started integrating probabilities
Diffstat (limited to 'ricky/params.py')
| -rw-r--r-- | ricky/params.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ricky/params.py b/ricky/params.py index c5595d4..4f91776 100644 --- a/ricky/params.py +++ b/ricky/params.py @@ -18,10 +18,22 @@ class Params(object): """string representation""" return pprint.pformat(self.as_dict()) - def randomize(self): - """assign random values to all params, taking into account weight""" + def randomize( + self, + probabilities=None, + probabilities_local=False + ): + """assign random values to all params + if using a probabilities.json file, weight is taken + into account""" + if probabilities: + probabilities = self._load_probabilities(probabilities) + else if probabilities_local: + probabilities = self._load_probabilities(probabilities_local) + else: + probabilities = {} for param in self._params: - param.randomize() + param.randomize(probability=probabilities.get(param.name)) @property def api(self): |
