-
Notifications
You must be signed in to change notification settings - Fork 65
[ENH] allowing old function API to be passed as experiment #152
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
[ENH] allowing old function API to be passed as experiment #152
Conversation
src/hyperactive/experiment/func.py
Outdated
| return [params0, params1, params2] | ||
|
|
||
|
|
||
| def _func1(x): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions do not need to be top-level. Please move these test functions into the get_test_params-method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I thought they might be, otherwise the test sfor pickling might fail (when functions are in a local scope) but I will try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. This can happen with some pickling packages. Still, there must be a better way, then putting test data in source code files at top level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's private... I can try to move it into get_test_params, but I suspect it will cause test failures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
SimonBlanke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tasks:
- Please cleanup the test-functions
- Add a basic example similar to this: https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optimization_techniques/hill_climbing.py
|
I added the option as the "simplest" option in the |
From a user perspective, the ability to define ad-hoc functions via the old
my_callable(opt)notation was quite nice, and imo should be retained for compabitility with user code, and due to quick specification.This PR adds
my_callable(opt)signature to any optimizerFunctionExperimentwhich adapts functions to theBaseExperimentAPI. This experiment is public, since it is also useful when a user already has a function or callable to adapt.The feature also requires to relax the
BaseExperimentcontract, and allow passing ofparamswith unknown keys, or arbitrary keys, or keys not known in advance.