Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample fails to write to cache for dict_archive in ouq_models #206

Open
mmckerns opened this issue Aug 14, 2023 · 0 comments
Open

sample fails to write to cache for dict_archive in ouq_models #206

mmckerns opened this issue Aug 14, 2023 · 0 comments
Labels

Comments

@mmckerns
Copy link
Member

Use of a dict_archive in sample for an OUQModel fails to write back to the model cache when a dict_archive is used.

Python 3.8.17 (default, Jun 11 2023, 01:54:00) 
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ouq_models import WrapModel
>>> from emulators import cost4 as cost, bounds4 as bounds
>>> from mystic.cache.archive import dict_archive, read as create_db
>>> archive = create_db('truth', type=dict_archive)
>>> archive
dict_archive({}, cached=False)
>>> truth = WrapModel("truth", cost, nx=4, ny=None, cached=archive)
>>> truth([1,2,3,4])
1510.3774284161302
>>> archive
dict_archive({(1, 2, 3, 4): 1510.3774284161302}, cached=False)
>>> data = truth.sample(bounds, pts=[2, 1, 1, 1])
>>> archive
dict_archive({(1, 2, 3, 4): 1510.3774284161302}, cached=False)

This actually makes sense, as the archives used in sample is potentially different than the archive used as the model's cache... and one might specify the sampling archive to be different than the cache, or the cache might not exist.

However... if one explicitly specifies the same dict_archive as used with the model's cache, it still doesn't work... and this would seem to be a bug.

>>> data = truth.sample(bounds, pts=[2, 1, 1, 1], archive=archive)
>>> archive
dict_archive({(1, 2, 3, 4): 1510.3774284161302}, cached=False)
@mmckerns mmckerns added the bug label Aug 14, 2023
@mmckerns mmckerns changed the title sampling fails to write to model cache for dict_archive in ouq_models sample fails to write to cache for dict_archive in ouq_models Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant