8000 Grid search by wedeling · Pull Request #386 · UCL-CCS/EasyVVUQ · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Grid search #386

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

Merged
merged 7 commits into from
Mar 2, 2023
Merged

Grid search #386

merged 7 commits into from
Mar 2, 2023

Conversation

wedeling
Copy link
Collaborator

Added a Grid_sampler to perform hyperparameter tuning for neural networks in parallel. New files:

  • easyvvuq/sampling/grid_sampler.py: the new sampler class
  • tests/test_grid_sampler.py: a test for the grid sampler
  • tutorials/hyperparameter_tuning_tutorial.ipynb: a tutorial on using the GridSampler to tune the hyperparameters of a TensorFlow neural network for character recognition.
  • tutorials/hyperparameter_tuning_tutorial_with_fabsim.ipynb: same as above, only using FabSim3 to submit the ensemble.

I tested it locally and on Archer2, using FabSim + QCG PilotJob.

@wedeling wedeling self-assigned this Feb 17, 2023
@DavidPCoster
Copy link
Collaborator

I will have a look, but could you first fix the errors shown by the ci/cd system?

For example:

E File "/home/runner/work/EasyVVUQ/EasyVVUQ/tests/grid_search/test_grid.py", line 6
38
E a = $x1
39
E ^
40
E SyntaxError: invalid syntax
41

@DavidPCoster
Copy link
Collaborator

I see how the error is happening -- the ci/cd server seems to be trying to compile all .py files, including the one you are using as a template for the encoder. Perhaps changing the suffix from .py to something like .template would work.

@DavidPCoster
Copy link
Collaborator

I am also shocked that 54 files have changed -- but most of these seem to be whitespace changes.

It would be better for me as a reviewer if such reformatting occurred in a separate pull request.

params["x2"] = {"type": "boolean", "default": True}

# python file is its own template
encoder = uq.encoders.GenericEncoder('tests/grid_search/test_grid.py',
Copy link
Collaborator

Choose a reason for hiding this comment

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

perhaps change the name to 'tests/grid_search/test_grid.template' so that the invalid program 'tests/grid_search/test_grid.py' is not checked by the CI/CD system

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, I didn't know it would try to complile these. Will change to .template indeed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And sorry for the 54 files, shouldn't have done the pep8 fixes

@@ -0,0 +1,14 @@
#!/usr/bin/python3
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest renaming this file to 'tests/grid_search/test_grid.template' so that the CI/CD tests don't fail when trying to see if the syntax is OK.

try:
fabsim("fetch_results", "", machine)
return True
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException'

Except block directly handles BaseException.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, you should never use try..except like this (with no exception type specified)

#get the output lines of fab <machine> stat
try:
out = subprocess.run(['fabsim', machine, 'stat'], stdout=subprocess.PIPE)
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException'

Except block directly handles BaseException.
Copy link
Collaborator
@DavidPCoster DavidPCoster left a comment

Choose a reason for hiding this comment

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

I'm happy except for the indicated changes so that the AFAB CI/CD tests run

@wedeling wedeling merged commit e758f21 into dev Mar 2, 2023
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
0