test_monotonic.py 482 B

1234567891011121314151617
  1. import numpy as np
  2. from irae_risk.monotonic import forward_map
  3. def test_forward_map_is_invariant_under_parameter_sign_symmetries():
  4. theta = np.array([1.2, 0.7, -1.5, 2.3])
  5. expected = forward_map(theta)
  6. equivalent_theta = (
  7. theta * np.array([1, -1, 1, 1]),
  8. theta * np.array([1, 1, -1, -1]),
  9. theta * np.array([1, -1, -1, -1]),
  10. )
  11. for equivalent in equivalent_theta:
  12. np.testing.assert_allclose(forward_map(equivalent), expected)