Improve log output when loading parameters

This commit is contained in:
Matthias 2021-04-23 20:35:30 +02:00
parent 191a31db30
commit 9dc7f776d9

View File

@ -260,12 +260,15 @@ class HyperStrategyMixin(object):
:param params: Dictionary with new parameter values. :param params: Dictionary with new parameter values.
""" """
if not params: if not params:
return logger.info(f"No params for {space} found, using default values.")
for attr_name, attr in self.enumerate_parameters(): for attr_name, attr in self.enumerate_parameters():
if attr_name in params: if params and attr_name in params:
if attr.load: if attr.load:
attr.value = params[attr_name] attr.value = params[attr_name]
logger.info(f'Strategy Parameter: {attr_name} = {attr.value}') logger.info(f'Strategy Parameter: {attr_name} = {attr.value}')
else: else:
logger.warning(f'Parameter "{attr_name}" exists, but is disabled. ' logger.warning(f'Parameter "{attr_name}" exists, but is disabled. '
f'Default value "{attr.value}" used.') f'Default value "{attr.value}" used.')
else:
logger.info(f'Strategy Parameter(default): {attr_name} = {attr.value}')