[ENH] allowing old function API to be passed as experiment#152
[ENH] allowing old function API to be passed as experiment#152SimonBlanke merged 20 commits intohyperactive-project:mainfrom
Conversation
src/hyperactive/experiment/func.py
Outdated
| return [params0, params1, params2] | ||
|
|
||
|
|
||
| def _func1(x): |
There was a problem hiding this comment.
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.
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.
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.
it's private... I can try to move it into get_test_params, but I suspect it will cause test failures
SimonBlanke
left a comment
There was a problem hiding this comment.
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.