secondmind-labs / trieste

A Bayesian optimization toolbox built on TensorFlow
Apache License 2.0
212 stars 41 forks source link

Acquisition builder functions like Product and Sum lead to repetitive results in versions > 0.11.0 with ask-tell interface #602

Open ioananikova opened 1 year ago

ioananikova commented 1 year ago

Describe the bug When an acquisition builder like Product or Sum is used together with the ask-tell interface, The points returned by AskTellOptimizer.ask() is sometimes repetitive or a point very close to the previously returned point. Example: if at the first step ask returns [0.46428186 0.30237041], the second time it returns [0.46428241 0.30237408]. This does not make sense, because printing the value of the acquisition function at each step I learned that it has dropped significantly (from 2262.721274801444 to 4.4574170376814427e-05) and there is no way the second time the best point was returned. When there is only one acquisition function given to the builder or if there is no builder, the returned points are as expected.

To reproduce Steps to reproduce the behaviour:

  1. Create a python file in which a builder is used as acquisition function with 2 or more acquisition functions in it.
  2. Also make sure the ask-tell interface is used (I have not tested it without the ask-tell interface)
  3. compare the results with the case when no builder or only one function is used in the builder.

Included is a minimal reproducible code example. (Change extension to .py) test_trieste.txt

Expected behaviour At each step a new point should be given and not a point very close to the previous one every second step. The expected results can be achieved by changing trieste to version 0.10.0. Comparing the results between version 0.12.0 and 0.10.0 I have noticed that the order in which 0.12.0 returns the points is correct (as in 0.10.0) but it "repeats" them. Note that I have only tested this with ask-tell interface and not with the default BO.

System information

ioananikova commented 1 year ago

Issue still exists with Trieste 0.13.0. Attaching updated file now that the single objective test functions have been changed. test_trieste_v13.txt

vpicheny commented 1 year ago

Running your minimal test on trieste 0.12.0 gives me this set of query points, that does not contain any near duplicates:

array([[0.94632469, 0.85104985], [0.19632469, 0.18438318], [0.69632469, 0.62882762], [0.32132469, 0.96216096], [0.82132469, 0.29549429], [0.07132469, 0.4066054 ], [0.72945716, 0.90323204], [0.59638144, 0. ], [0. , 0.78050248], [0.38193714, 0.67199697], [1. , 0.61363953], [0. , 0. ], [0.507807 , 0.26822465], [1. , 0. ], [0. , 1. ], [0. , 0.57898001]])>

Are you getting something completely different?

ioananikova commented 1 year ago

My test contains multiple examples. The one that you are showing is indeed the working example. If you comment line 47 and uncomment 51-54 (or 56-59) you will see the results with near duplicates. Below are the results I am getting then (with 0.13.0): SUM example (lines 51-54): [0.71917768 0.91394111] [0.71917767 0.91394106] [0.6202339 0.0200358] [0.62021785 0.01978155] [0. 0.78416437] [0. 1.] [0.38298648 0.62870934] [0.37817355 0.61541523] [0. 0.] [0. 0.]