def hyperopt(matrix, configs, metrics): """Create suggestions based on hyperopt.""" from polyaxon.polyflow import V1Hyperopt from polyaxon.polytune.search_managers.hyperopt.manager import HyperoptManager matrix = V1Hyperopt.read(matrix) suggestions = HyperoptManager(config=matrix).get_suggestions( configs=configs, metrics=metrics) log_suggestions(suggestions) Printer.print_success("Suggestions generated with hyperopt")
def hyperopt(matrix, join, iteration): """Create suggestions based on hyperopt.""" from polyaxon.client import RunClient from polyaxon.polyflow import V1Hyperopt, V1Join from polyaxon.polytune.iteration_lineage import ( get_iteration_definition, handle_iteration, handle_iteration_failure, ) from polyaxon.polytune.search_managers.hyperopt.manager import HyperoptManager matrix = V1Hyperopt.read(matrix) join = V1Join.read(join) client = RunClient() values = get_iteration_definition( client=client, iteration=iteration, join=join, optimization_metric=matrix.metric.name, ) if not values: return run_uuids, configs, metrics = values retry = 1 exp = None suggestions = None while retry < 3: try: suggestions = HyperoptManager(config=matrix).get_suggestions( configs=configs, metrics=metrics) exp = None break except Exception as exp: retry += 1 logger.warning(exp) if exp: handle_iteration_failure(client=client, exp=exp) return handle_iteration( client=client, iteration=iteration, suggestions=suggestions, )
def hyperopt(matrix, configs, metrics, iteration): """Create suggestions based on hyperopt.""" from polyaxon.client import RunClient from polyaxon.polyflow import V1Hyperopt from polyaxon.polytune.iteration_lineage import ( handle_iteration, handle_iteration_failure, ) from polyaxon.polytune.search_managers.hyperopt.manager import HyperoptManager matrix = V1Hyperopt.read(matrix) if configs: configs = ujson.loads(configs) if metrics: metrics = ujson.loads(metrics) client = RunClient() retry = 1 exp = None suggestions = None while retry < 3: try: suggestions = HyperoptManager(config=matrix).get_suggestions( configs=configs, metrics=metrics) exp = None break except Exception as e: retry += 1 logger.warning(e) exp = e if exp: handle_iteration_failure(client=client, exp=exp) return handle_iteration( client=client, suggestions=suggestions, )