def test_environment_init_metrics(metrics, expected):
    env = Environment(**dict(
        default_env_params,
        **dict(metrics_params=dict(
            metrics_map=metrics, in_fold="all", oof="all", holdout="all")),
    ))
    assert env == expected
示例#2
0
def env_fixture_1():
    return Environment(
        train_dataset=get_toy_classification_data(),
        results_path=None,
        metrics=["roc_auc_score"],
        cv_type="StratifiedKFold",
        cv_params=dict(n_splits=5, shuffle=True, random_state=32),
    )
def test_environment_init_cross_experiment_params(runs, cv_type, _cv_params, expected):
    env = Environment(
        **dict(
            default_env_params,
            **dict(runs=runs, cross_validation_type=cv_type, cross_validation_params=_cv_params),
        )
    )
    assert env == expected
示例#4
0
def env_fixture_0():
    return Environment(
        train_dataset=get_toy_classification_data(),
        results_path=
        "hyperparameter_hunter/__TEST__HyperparameterHunterAssets__",
        metrics=["roc_auc_score"],
        cv_type="StratifiedKFold",
        cv_params=dict(n_splits=5, shuffle=True, random_state=32),
    )
def test_environment_repr(env_params):
    """Test that :meth:`Environment.__repr__` returns the expected value"""
    env = Environment(**env_params)
    assert env.__repr__(
    ) == f"Environment(cross_experiment_key={env.cross_experiment_key!s})"
def test_environment_init_cv_params(_cv_params, expected):
    env = Environment(
        **dict(default_env_params, **dict(cross_validation_params=_cv_params)))
    assert env == expected