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

Refactor GIBBON to avoid retracing #349

Merged
merged 12 commits into from
Sep 16, 2021

Conversation

uri-granta
Copy link
Collaborator

No description provided.

@uri-granta uri-granta changed the title Uri/refactor mes acqs Refactor GIBBON to avoid retracing Sep 14, 2021
@henrymoss henrymoss self-requested a review September 15, 2021 08:38
Comment on lines +467 to 469
tf.debugging.assert_rank(samples, 2)
tf.debugging.assert_positive(len(samples))
self._samples.assign(samples)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added in a few of these extra asserts. Was there a reason not to have these before? I guess they will need unit testing now

Comment on lines +1935 to +1957
def _get_min_value_samples(
model: ProbabilisticModel,
dataset: Dataset,
sampled_points: TensorType,
num_samples: int,
use_thompson: bool,
num_fourier_features: Optional[int] = None,
) -> TensorType:

if not use_thompson: # use Gumbel sampler
sampler: ThompsonSampler = GumbelSampler(num_samples, model)
elif num_fourier_features is not None: # use approximate Thompson sampler
sampler = RandomFourierFeatureThompsonSampler(
num_samples,
model,
dataset,
sample_min_value=True,
num_features=num_fourier_features,
)
else: # use exact Thompson sampler
sampler = ExactThompsonSampler(num_samples, model, sample_min_value=True)

return sampler.sample(sampled_points)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs unit testing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These is a private function so wouldn't normally be unit tested directly. The code paths are tested instead via MinValueEntropySearch and GIBBON.

@henrymoss henrymoss self-requested a review September 16, 2021 14:33
Copy link
Collaborator

@henrymoss henrymoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@uri-granta uri-granta merged commit 62f7284 into secondmind-labs:develop Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants