def test_logit_numeric_value(): assert np.isclose(ef.logit(4), 1 / (1 + np.exp(-4)))
def test_logit_numeric_input_no_deriv(): with pytest.raises(AttributeError): assert ef.logit(30).der
def test_logit_illegal_arg(): with pytest.raises(AttributeError): assert ef.logit("thirty")
def test_logit_deriv2_xy(): x = AutoDiff(1.1, "x", H=True) y = AutoDiff(2.2, "y", H=True) f = ef.logit(x * x * y * y) assert np.isclose(f.der2['xy'], -0.1328331881720229)
def test_logit_no_sec_derivative_xy(): x = AutoDiff(4, "x") y = AutoDiff(5, "y") with pytest.raises(AttributeError): assert ef.logit(x * x * y * y).der2['x']
def test_logit_deriv2_y(): x = AutoDiff(1.1, "x", H=True) y = AutoDiff(2.2, "y", H=True) f = ef.logit(x * x * y * y) assert np.isclose(f.der2['y'], -0.07330202652166372)
def test_logit_deriv2_x(): x = AutoDiff(1.1, "x", H=True) y = AutoDiff(2.2, "y", H=True) f = ef.logit(x * x * y * y) assert np.isclose(f.der2['x'], -0.2932081060866549)
def test_logit_deriv_y(): x = AutoDiff(1.1, "x") y = AutoDiff(2.2, "y") f = ef.logit(x * x * y * y) assert np.isclose(f.der['y'], 0.015147951358435)
def test_logit_deriv_x(): x = AutoDiff(1.1, "x") y = AutoDiff(2.2, "y") f = ef.logit(x * x * y * y) assert np.isclose(f.der['x'], 0.03029590271687)
def test_logit_val(): x = AutoDiff(1.1, "x") y = AutoDiff(2.2, "y") f = ef.logit(x * x * y * y) assert np.isclose(f.val, 0.9971466383123472)