89d58cff936536b94f74021635412650b56e22e5,deeppavlov/models/evolution/evolution_param_generator.py,ParamsEvolution,sample_params,#ParamsEvolution#,431

Before Change


            params_copy = deepcopy(params)
        params_sample = dict()
        for param, param_val in params_copy.items():
            if isinstance(param_val, list):
                params_sample[param] = random.choice(param_val)
            elif isinstance(param_val, dict):
                if "evolve_bool" in param_val and param_val["evolve_bool"]:
                    sample = bool(random.choice([True, False]))
                elif "evolve_range" in param_val:
                    sample = self._sample_from_ranges(param_val)
                params_sample[param] = sample
            else:
                params_sample[param] = params_copy[param]
        return params_sample

    def _sample_from_ranges(self, opts):
        from_ = opts["evolve_range"][0]

After Change


                    sample = bool(random.choice([True, False]))
                elif "evolve_range" in param_val:
                    sample = self._sample_from_ranges(param_val)
                elif "evolve_choice" in param_val:
                    sample = random.choice(param_val["values"])
                params_sample[param] = sample
            else:
                params_sample[param] = params_copy[param]
        return params_sample
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: deepmipt/DeepPavlov
Commit Name: 89d58cff936536b94f74021635412650b56e22e5
Time: 2018-06-20
Author: dilyara.rimovna@gmail.com
File Name: deeppavlov/models/evolution/evolution_param_generator.py
Class Name: ParamsEvolution
Method Name: sample_params


Project Name: ray-project/ray
Commit Name: ef498e8aa5cdfe09247d9c9efc7ef636378165c2
Time: 2020-05-15
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/policy.py
Class Name: PowerOfTwoPolicy
Method Name: flush


Project Name: deepmipt/DeepPavlov
Commit Name: c3f62292951d971607561821d6cdd67bfe77fb27
Time: 2018-06-26
Author: dilyara.rimovna@gmail.com
File Name: deeppavlov/models/evolution/evolution_param_generator.py
Class Name: ParamsEvolution
Method Name: sample_params