Skip to content

Conversation

@fkiraly
Copy link
Collaborator

@fkiraly fkiraly commented Aug 14, 2025

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

  • the ability to pass functions of the old my_callable(opt) signature to any optimizer
  • a FunctionExperiment which adapts functions to the BaseExperiment API. 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 BaseExperiment contract, and allow passing of params with unknown keys, or arbitrary keys, or keys not known in advance.

@fkiraly fkiraly added the enhancement New feature or request label Aug 14, 2025
@fkiraly fkiraly added this to the v5.0 milestone Aug 15, 2025
return [params0, params1, params2]


def _func1(x):
Copy link
Collaborator

@SimonBlanke SimonBlanke Aug 17, 2025

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.

Copy link
Collaborator Author

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

Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

@SimonBlanke SimonBlanke left a comment

Choose a reason for hiding this comment

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

Tasks:

@fkiraly fkiraly requested a review from SimonBlanke August 22, 2025 17:58
@fkiraly
Copy link
Collaborator Author

fkiraly commented Aug 22, 2025

I added the option as the "simplest" option in the hyperactive_intro notebook

@SimonBlanke SimonBlanke merged commit 0950a7b into hyperactive-project:main Sep 1, 2025
38 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants