hyperopt Remove unnecessary arguments

This commit is contained in:
Matthias 2022-09-11 11:56:17 +02:00
parent 32e13d65c3
commit 78cd46ecd5

View File

@ -290,7 +290,7 @@ class Hyperopt:
# noinspection PyProtectedMember # noinspection PyProtectedMember
attr.value = params_dict[attr_name] attr.value = params_dict[attr_name]
def generate_optimizer(self, raw_params: List[Any], iteration=None) -> Dict[str, Any]: def generate_optimizer(self, raw_params: List[Any]) -> Dict[str, Any]:
""" """
Used Optimize function. Used Optimize function.
Called once per epoch to optimize whatever is configured. Called once per epoch to optimize whatever is configured.
@ -411,10 +411,10 @@ class Hyperopt:
) )
def run_optimizer_parallel( def run_optimizer_parallel(
self, parallel: Parallel, asked: List[List], i: int) -> List[Dict[str, Any]]: self, parallel: Parallel, asked: List[List]) -> List[Dict[str, Any]]:
""" Start optimizer in a parallel way """ """ Start optimizer in a parallel way """
return parallel(delayed( return parallel(delayed(
wrap_non_picklable_objects(self.generate_optimizer))(v, i) for v in asked) wrap_non_picklable_objects(self.generate_optimizer))(v) for v in asked)
def _set_random_state(self, random_state: Optional[int]) -> int: def _set_random_state(self, random_state: Optional[int]) -> int:
return random_state or random.randint(1, 2**16 - 1) return random_state or random.randint(1, 2**16 - 1)
@ -588,7 +588,7 @@ class Hyperopt:
current_jobs = jobs - n_rest if n_rest > 0 else jobs current_jobs = jobs - n_rest if n_rest > 0 else jobs
asked, is_random = self.get_asked_points(n_points=current_jobs) asked, is_random = self.get_asked_points(n_points=current_jobs)
f_val = self.run_optimizer_parallel(parallel, asked, i) f_val = self.run_optimizer_parallel(parallel, asked)
self.opt.tell(asked, [v['loss'] for v in f_val]) self.opt.tell(asked, [v['loss'] for v in f_val])
# Calculate progressbar outputs # Calculate progressbar outputs