ATHENA icon indicating copy to clipboard operation
ATHENA copied to clipboard

Replace GPyOpt with BayesianOptimization and Add NumPy 2.0+ Compatibility

Open k1nshuk opened this issue 8 months ago • 1 comments

This PR resolves issue #130 by implementing two changes to the ATHENA package:

  1. 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_matrix method in feature_map.py to 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
  1. NumPy 2.0+ Compatibility
  • [x] Added a new compatibility.py module to handle version-specific implementations
  • [x] Implemented a custom KMedoids class that works with NumPy 2.0+
  • [x] Updated the KMedoids import in local.py to use this compatibility layer
  • [x] Made scikit-learn-extra an optional dependency since it may have issues with newer NumPy versions
  • [x] Added packaging as a dependency for proper version comparison
  1. Updated CI Configuration
  • [x] Modified ci.yml to remove NumPy version restriction
  • [x] Made scikit-learn-extra installation optional in the CI workflow
  • [x] Added packaging as a dependency in the CI setup
  1. Bug Fixes
  • [x] Fixed a LaTeX syntax error in subspaces.py causing 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 avatar May 29 '25 05:05 k1nshuk

@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.

mtezzele avatar Jun 04 '25 15:06 mtezzele