Exemplo n.º 1
0
def update_hyperopt_params_with_defaults(hyperopt_params):
    set_default_value(hyperopt_params, STRATEGY, {})
    set_default_value(hyperopt_params, EXECUTOR, {})
    set_default_value(hyperopt_params, "split", VALIDATION)
    set_default_value(hyperopt_params, "output_feature", COMBINED)
    set_default_value(hyperopt_params, "metric", LOSS)
    set_default_value(hyperopt_params, "goal", MINIMIZE)

    set_default_values(hyperopt_params[STRATEGY], {TYPE: "random"})

    strategy = get_from_registry(hyperopt_params[STRATEGY][TYPE],
                                 sampler_registry)
    strategy_defaults = {
        k: v
        for k, v in strategy.__dict__.items()
        if k in get_class_attributes(strategy)
    }
    set_default_values(
        hyperopt_params[STRATEGY],
        strategy_defaults,
    )

    set_default_values(hyperopt_params[EXECUTOR], {TYPE: "serial"})

    executor = get_from_registry(hyperopt_params[EXECUTOR][TYPE],
                                 executor_registry)
    executor_defaults = {
        k: v
        for k, v in executor.__dict__.items()
        if k in get_class_attributes(executor)
    }
    set_default_values(
        hyperopt_params[EXECUTOR],
        executor_defaults,
    )
Exemplo n.º 2
0
def update_hyperopt_params_with_defaults(hyperopt_params):
    from ludwig.hyperopt.execution import executor_registry

    set_default_value(hyperopt_params, EXECUTOR, {})
    set_default_value(hyperopt_params, "split", VALIDATION)
    set_default_value(hyperopt_params, "output_feature", COMBINED)
    set_default_value(hyperopt_params, "metric", LOSS)
    set_default_value(hyperopt_params, "goal", MINIMIZE)

    set_default_values(hyperopt_params[EXECUTOR], {TYPE: "ray"})
    executor = get_from_registry(hyperopt_params[EXECUTOR][TYPE],
                                 executor_registry)
    executor_defaults = {
        k: v
        for k, v in executor.__dict__.items()
        if k in get_class_attributes(executor)
    }
    set_default_values(
        hyperopt_params[EXECUTOR],
        executor_defaults,
    )