Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure in test_two_loggers_in_healthsystem when running on Pandas 2.0 #1127

Closed
matt-graham opened this issue Sep 22, 2023 · 1 comment · Fixed by #1142
Closed

Test failure in test_two_loggers_in_healthsystem when running on Pandas 2.0 #1127

matt-graham opened this issue Sep 22, 2023 · 1 comment · Fixed by #1142

Comments

@matt-graham
Copy link
Collaborator

One test failure still when running with Pandas 2.0 / Python 3.11

____________ test_two_loggers_in_healthsystem[83563095832589325021] ____________
tests/test_healthsystem.py:841: in test_two_loggers_in_healthsystem
    assert summary_hsi_event['squeeze_factor'].apply(pd.Series) \
E   AssertionError: assert {('Dummy:HSI_Dummy', 2010): 113431310.40270479, ('Dummy:HSI_Dummy', 2011): 113431310.40270479, ('Inpatient_Care:Inpatient_Care', 2010): 0.0, ('Inpatient_Care:Inpatient_Care', 2011): 0.0} == {('Dummy:HSI_Dummy', 2010): 113431310.40270501, ('Dummy:HSI_Dummy', 2011): 113431310.40270501, ('Inpatient_Care:Inpatient_Care', 2010): 0.0, ('Inpatient_Care:Inpatient_Care', 2011): 0.0}
E     Common items:
E     {('Inpatient_Care:Inpatient_Care', 2010): 0.0,
E      ('Inpatient_Care:Inpatient_Care', 2011): 0.0}
E     Differing items:
E     {('Dummy:HSI_Dummy', 2010): 113431310.40270479} != {('Dummy:HSI_Dummy', 2010): 113431310.40270501}
E     {('Dummy:HSI_Dummy', 2011): 113431310.40270479} != {('Dummy:HSI_Dummy', 2011): 113431310.40270501}
E     Full diff:
E       {
E     -  ('Dummy:HSI_Dummy', 2010): 113431310.40270501,
E     ?                                            ^^^
E     +  ('Dummy:HSI_Dummy', 2010): 113431310.40270479,
E     ?                                            ^^^
E     -  ('Dummy:HSI_Dummy', 2011): 113431310.40270501,
E     ?                                            ^^^
E     +  ('Dummy:HSI_Dummy', 2011): 113431310.40270479,
E     ?                                            ^^^
E        ('Inpatient_Care:Inpatient_Care', 2010): 0.0,
E        ('Inpatient_Care:Inpatient_Care', 2011): 0.0,
E       }

Originally posted by @matt-graham in #1114 (comment)

@matt-graham
Copy link
Collaborator Author

Looking at the actual numerical differences this could just be due to floating point errors arising from computation of summations in different orders. The relative difference (113431310.40270501 - 113431310.40270479) / (113431310.40270479) is of order 1e-15 which is close to machine epsilon for double precision floats. We may just need to slightly relax the assertion to use something like numpy.allclose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant