Replace GPyOpt with BayesianOptimization and Add NumPy 2.0+ Compatibility
This PR resolves issue #130 by implementing two changes to the ATHENA package:
- Replacing GPyOpt with BayesianOptimization
- [x] Migrated from the less maintained GPyOpt library to the more actively maintained bayesian-optimization package
- [x] Modified the
tune_pr_matrixmethod infeature_map.pyto use the new API - [x] Updated all associated tests to work with the new implementation
- [x] Added an example script (
feature_map_bayes_opt_example.py) demonstrating the new functionality
- NumPy 2.0+ Compatibility
- [x] Added a new
compatibility.pymodule to handle version-specific implementations - [x] Implemented a custom KMedoids class that works with NumPy 2.0+
- [x] Updated the KMedoids import in
local.pyto use this compatibility layer - [x] Made
scikit-learn-extraan optional dependency since it may have issues with newer NumPy versions - [x] Added packaging as a dependency for proper version comparison
- Updated CI Configuration
- [x] Modified
ci.ymlto remove NumPy version restriction - [x] Made
scikit-learn-extrainstallation optional in the CI workflow - [x] Added packaging as a dependency in the CI setup
- Bug Fixes
- [x] Fixed a LaTeX syntax error in
subspaces.pycausing a test failure - [x] Adjusted tests to check for shape rather than exact values when appropriate
Dependency Changes
- Added: bayesian-optimization,
packaging - Made optional: scikit-learn-extra
- Removed: GPyOpt
- Removed restriction: numpy<2.0.0]
Testing
All 215 tests are now passing, showing that the changes maintain backward compatibility while enabling use of newer NumPy versions. The example script also demonstrates that the BayesianOptimization implementation works correctly.
Documentation
Updated example code to demonstrate the usage of BayesianOptimization for parameter tuning in ATHENA
@k1nshuk thank you so much for this PR. It was long needed!
I will review it in the next few days. Probably there are still a couple of places where GPy has to be removed. Probably we can also add to the test matrix newer Python versions, feel free to add up to py 3.12.