def get_scored_params(experiment_description_path, target_metric):
    """Retrieve the hyperparameters of a completed Experiment, along with an evaluation of its performance

    Parameters
    ----------
    experiment_description_path: String
        The path to an Experiment's description .json file
    target_metric: Tuple
        A path denoting the metric to be used. If tuple, the first value should be one of ['oof', 'holdout', 'in_fold'], and the
        second value should be the name of a metric supplied in :attr:`environment.Environment.metrics_params`

    Returns
    -------
    all_hyperparameters: Dict
        A dict of the hyperparameters used by the Experiment
    evaluation: Float
        Value of the Experiment's `target_metric`"""
    description = read_json(file_path=experiment_description_path)
    evaluation = get_path(description['final_evaluations'], target_metric)
    all_hyperparameters = description['hyperparameters']

    if description['module_name'].lower() == 'keras':
        all_hyperparameters['model_init_params'][
            'layers'] = consolidate_layers(
                all_hyperparameters['model_init_params']['layers'],
                class_name_key=False,
                separate_args=False)

    return (all_hyperparameters, evaluation)
def get_scored_params(experiment_description_path,
                      target_metric,
                      get_description=False):
    """Retrieve the hyperparameters of a completed Experiment, along with its performance evaluation

    Parameters
    ----------
    experiment_description_path: String
        The path to an Experiment's description .json file
    target_metric: Tuple
        A path denoting the metric to be used. If tuple, the first value should be one of ['oof',
        'holdout', 'in_fold'], and the second value should be the name of a metric supplied in
        :attr:`environment.Environment.metrics_params`
    get_description: Boolean, default=False
        If True, return a tuple of: ((`all_hyperparameters`, `evaluation`), `description`), in which
        `description` is the original description dict for the experiment. Else, return a tuple of:
        (`all_hyperparameters`, `evaluation`)

    Returns
    -------
    all_hyperparameters: Dict
        A dict of the hyperparameters used by the Experiment
    evaluation: Float
        Value of the Experiment's `target_metric`"""
    description = read_json(file_path=experiment_description_path)
    evaluation = get_path(description["final_evaluations"], target_metric)
    all_hyperparameters = description["hyperparameters"]

    if description["module_name"].lower() == "keras":
        all_hyperparameters["model_init_params"][
            "layers"] = consolidate_layers(
                all_hyperparameters["model_init_params"]["layers"],
                class_name_key=False)

    if get_description:
        return ((all_hyperparameters, evaluation), description)
    return (all_hyperparameters, evaluation)
def test_consolidate_layers(expected, class_name_key, split_args):
    assert consolidate_layers(simple_mlp_layers, class_name_key, split_args) == expected