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

Reuse hyperparameters #41

Merged
merged 9 commits into from
Aug 8, 2023
Merged

Reuse hyperparameters #41

merged 9 commits into from
Aug 8, 2023

Conversation

thomaswmorris
Copy link
Collaborator

This introduces functionality to save/specify a priori hyperparameters on initialization, which speeds up optimization.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Member

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

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

I have a few non-blocking suggestions below.

Let's make sure we add docstrings to all public functions/classes within the documentation improvement efforts.

Copy link
Member

Choose a reason for hiding this comment

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

The name of this module needs to be changed, otherwise, pytest may pick it up (although won't execute any tests).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can we just add addopts = --ignore=somedir to pytest.ini?

Comment on lines +16 to +30
def constrained_himmelblau(x1, x2):
if x1**2 + x2**2 > 50:
return np.nan
return himmelblau(x1, x2)


def skewed_himmelblau(x1, x2):
_x1 = 2 * x1 + x2
_x2 = 0.5 * (x1 - 2 * x2)

return constrained_himmelblau(_x1, _x2)


def bukin(x1, x2):
return 100 * np.sqrt(np.abs(x2 - 1e-2 * x1**2)) + 0.01 * np.abs(x1)
Copy link
Member

Choose a reason for hiding this comment

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

All these functions need a docstring with a reference to Wikipedia or other resources.

Comment on lines +38 to +39
RE(agent.learn("ei", n_iter=2))
RE(agent.learn("pi", n_iter=2))
Copy link
Member

Choose a reason for hiding this comment

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

All these options need to be listed in the general documentation (in Intro section, not in tutorials (=notebooks)).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll make a PR with improved documentation outside the tutorials, for this and the above

Comment on lines +7 to 15
def dummy_dof(name):
return Signal(name=name, value=0.0)


def dummy_dofs(n=2):
return [Signal(name=f"x{i+1}", value=0) for i in range(n)]
return [dummy_dof(name=f"x{i+1}") for i in range(n)]


def get_dummy_device(name="dofs", n=2):
Copy link
Member

Choose a reason for hiding this comment

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

Docstrings should be added.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is overhauled in the next PR

Copy link
Member

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

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

Looks good, let's incorporate it in other PRs.

@mrakitin mrakitin merged commit bc7e620 into NSLS-II:main Aug 8, 2023
5 checks passed
@thomaswmorris thomaswmorris deleted the reuse-hypers branch November 4, 2023 14:33
thomaswmorris pushed a commit to thomaswmorris/blop that referenced this pull request Jul 15, 2024
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.

2 participants