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

Start model refactoring and fix tests #101

Open
wants to merge 3 commits into
base: commented_version
Choose a base branch
from

Conversation

swillner
Copy link

We started refactoring in models.py (more changes will follow). This is WIP, but as a first step to overall refactoring we think this could already be reviewed.

During the refactoring we found that in one place the calculation differed from those in other places.
In the original code for tasrange a factor 2 was missing when calculating the weights.

https://github.com/ISI-MIP/attrici/blob/8a735037f3d0e78f842e9646bcb66614179bc2df/attrici/models.py#L554C1-L554C90

The resulting changes in the output are minor, we adjusted the accuracy of the tests accordingly.

This PR also includes a fix for the tests to always run the tests (which are only run locally, not in CI, because they take some time to run) without using the cache.

rgieseke and others added 3 commits October 28, 2024 13:00
Co-authored-by: Sven Willner <[email protected]>
Co-authored-by: Robert Gieseke <[email protected]>
In the original code for tasrange a factor 2 was missing when
calculating weights.

https://github.com/ISI-MIP/attrici/blob/8a735037f3d0e78f842e9646bcb66614179bc2df/attrici/models.py#L554C1-L554C90

Co-authored-by: Sven Willner <[email protected]>
Co-authored-by: Robert Gieseke <[email protected]>
@matthiasmengel
Copy link
Member

I am not getting yet where the bug was.

            weights_nu_fc_intercept = pm.math.concatenate(
                [pm.Normal(f"weights_nu_fc_intercept_{i}", mu=0, sd=1 / (i + 1), shape=2)
                 for i in range(int(xf0v.dshape[1]) // 2)]
            )

seems to be consistent everywhere.

@swillner
Copy link
Author

swillner commented Nov 5, 2024

The difference is the missing 2 * in sd=1 / (i + 1) (vs. as in the paper sd=1 / (2 * i + 1)).

Copy link
Collaborator

@SimonTreu SimonTreu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me the changes look good. The code structure is much clearer now and code duplication is avoided.

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 this pull request may close these issues.

4 participants