PKU-DAIR / open-box

Generalized and Efficient Blackbox Optimization System
https://open-box.readthedocs.io
Other
376 stars 52 forks source link

Skip/Ignore Outcome of an Iteration during Optimization #83

Closed Jekannadar closed 8 months ago

Jekannadar commented 8 months ago

I am running an optimisation for which invidual iterations sometimes can unexpectedly fail. I want to ignore these failures, as they are rare and don't reflect the actual underlying function.

E.g. the parameter 5.000001 will run succesfully, 5.000002 will fail, and 5.000003 and 5.000004 would work again.

Until now I have been returning a very high value for that iteration run (1000000), most iterations return values below 0.2. But this guides the optimizer away from that point in the Space.

If I raise an exception during the black box function, then the objectives return as Infinity. Is there a way to just ignore the iteration entirely instead if this happened?

rmrmg commented 8 months ago

You can use Advisor see https://github.com/PKU-DAIR/open-box/blob/96841e65a7e9900e5549d5f68411db35500f2e92/examples/ask_and_tell_interface.py or https://github.com/PKU-DAIR/open-box/issues/82#issuecomment-1925621619

When one point in your space failed simply dont do advisor.update_observation or you can manually change config_space for the problematic point and sample something very close to the point.

Jekannadar commented 8 months ago

Thank you very much, that works perfectly!