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

Experimenter bug #176

Merged
merged 5 commits into from
May 28, 2024
Merged

Experimenter bug #176

merged 5 commits into from
May 28, 2024

Conversation

barneydobson
Copy link
Collaborator

Description

There was a bug in process_parameters to do with parameter setting. Now fixed and tests added so that the case is properly avoided.

Dobson added 2 commits May 23, 2024 15:15
@barneydobson barneydobson requested review from cheginit and dalonsoa May 23, 2024 14:44
@barneydobson barneydobson mentioned this pull request May 23, 2024
5 tasks
Copy link
Collaborator

@cheginit cheginit left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

The actual code looks sensible, but I do not understand how the tests are meaningful. Override or not override, the result is always the same. See details below.

Comment on lines +61 to +68
config['parameter_overrides'] = {'hydraulic_design': {'min_v': 1.0}}
with mock.patch('swmmanywhere.paper.experimenter.swmmanywhere.swmmanywhere',
return_value=('fake_path',{'fake_metric' : 1})) as mock_sa:
result = experimenter.process_parameters(0,1,config)

assert len(result[0]) == 48
assert_close(result[0][0]['min_v'], 0.310930)
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is this testing that the experimenter overrides do anything at all? The results you are asserting are identical to the previous case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The point is that the experimenter parameter selection (passed via parameter_overrides) takes precedence over a config defined parameter override. It should be the same as before even though we have provided an override.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For this and subsequent comments - I have tried to address by improving the docstring of process_parameters


# Test non experimenter overrides still work
config['parameter_overrides'] = {'hydraulic_design': {'max_fr': 0.5}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this a non-experimenter override?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The experimenter passes parameters to main function via parameter_overrides in the config file. The parameters it is sampling are min_v and max_v. So max_fr is a 'non-experimenter override', i.e., one that is not provided by the experimenter function.

If I am running the experimenter and provide my own overrides that are nothing to do with parameters_to_sample I want to check that they are still set

Comment on lines +79 to +80
assert_close(result[0][0]['min_v'], 0.310930)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, no change in the assert statements.

Copy link
Collaborator Author

@barneydobson barneydobson May 24, 2024

Choose a reason for hiding this comment

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

The setting of max_fr should not have interacted with the sampling of min_v - this is testing that

@barneydobson barneydobson merged commit b77daf9 into main May 28, 2024
8 checks passed
@barneydobson barneydobson deleted the experimenter_bug branch May 28, 2024 13:46
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.

3 participants