Пример #1
0
def investigate_regression_test(idx):
    """Investigate regression tests."""
    tests = load_regression_tests()
    params, options, exp_val = tests[idx]

    crit_val = compute_log_likelihood(params, options)

    assert np.isclose(
        crit_val, exp_val, rtol=TOL_REGRESSION_TESTS, atol=TOL_REGRESSION_TESTS
    )
Пример #2
0
def _create_single(idx):
    """Create a single test."""
    np.random.seed(idx)

    params, options = generate_random_model()

    crit_val = compute_log_likelihood(params, options)

    if not isinstance(crit_val, float):
        raise AssertionError(" ... value of criterion function too large.")

    return params, options, crit_val
Пример #3
0
def _check_single(test, strict):
    """Check a single test."""
    params, options, exp_val = test

    try:
        crit_val = compute_log_likelihood(params, options)
        is_success = np.isclose(
            crit_val, exp_val, rtol=TOL_REGRESSION_TESTS, atol=TOL_REGRESSION_TESTS
        )
    except Exception:
        is_success = False

    if strict is True:
        assert is_success, "Failed regression test."

    return is_success