Hyperactive
Hyperactive copied to clipboard
[ENH] Add categorical feature encoding for GFO adapters
To Resolve #136 This PR adds automatic categorical feature handling for GFO-based optimizers by encoding non-numeric search space dimensions to consecutive integers internally, then decoding them back when evaluating the objective and returning results. Changes:
- Categorical dimensions (detected via dtype: object, unicode, string, boolean) are encoded to consecutive integers using
np.unique - Original category mappings are stored in
_categorical_mappingsfor decoding - Decoding happens transparently during objective evaluation and when returning
best_params_ - Numeric dimensions are left unchanged
- Added
capability:categoricaltag with value "encoded" to_BaseGFOadapter - Added test covering mixed numeric/categorical search spaces
@fkiraly Please have a look, when time permits.