Hyperactive
Hyperactive copied to clipboard
[ENH] for `gfo` allow `numpy` coercibles and/or `sklearn` parameter grids as search spaces
The current gfo implementation allows to pass grid-like search spaces, similar to sklearn.
However, currently we cannot pass - but it would be desirable to:
- values that are not
np.ndarray-s, but coercible, i.e., 1D array-likes. If passed (e.g., lists), they get coerced tonp.ndarrayinternally - union grids, such as in
sklearn
More generally, it should not be too complicated to allow the full sklearn syntax to work - although coercion is probably much easier than supporting union grids.
Hi @fkiraly I would like to take on this issue. Can you elaborate a bit on this?
Hi @fkiraly , I'd like to work on this issue.
Proposed Approach
-
Input Coercion
- Update the internal handling of
gfoinputs so that any array-like structure (e.g., Python lists, tuples) is automatically converted into anumpy.ndarray. - This ensures consistent downstream processing and aligns with the examples provided in the issue where a list currently causes unexpected behavior.
- Update the internal handling of
-
Parameter Grid Handling
- Add support for common scikit-learn grid formats (
{"param": [values...]}) when compatible with the existing optimizer structure. - In cases where full scikit-learn union grids are not compatible, provide a clear and informative error message explaining the limitation.
- Ensure that the behavior remains deterministic and compatible with existing grid search logic in Hyperactive. If this approach looks good, I would be happy to proceed with the implementation.
- Add support for common scikit-learn grid formats (