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

Encoded DeepGPs. #873

Merged
merged 13 commits into from
Sep 18, 2024
Merged

Encoded DeepGPs. #873

merged 13 commits into from
Sep 18, 2024

Conversation

avullo
Copy link
Collaborator

@avullo avullo commented Sep 17, 2024

Related issue(s)/PRs:

Summary

Add support for encoding to Deep GPs models.

Fully backwards compatible: yes

PR checklist

  • The quality checks are all passing
  • The bug case / new feature is covered by tests
  • Any new features are well-documented (in docstrings or notebooks)

@avullo avullo marked this pull request as draft September 17, 2024 10:44
@avullo avullo marked this pull request as ready for review September 17, 2024 14:04
@avullo avullo requested a review from uri-granta September 17, 2024 16:12
Copy link
Collaborator

@uri-granta uri-granta left a comment

Choose a reason for hiding this comment

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

LGTM! Couple of very minor questions

@@ -96,7 +97,9 @@ def sample(self, at: TensorType, *, jitter: float = DEFAULTS.JITTER) -> TensorTy
tf.debugging.assert_shapes([(at, [..., 1, None])])
tf.debugging.assert_greater_equal(jitter, 0.0)

samples = tf.repeat(at[..., None, :, :], self._sample_size, axis=-3) # [..., S, 1, D]
samples = tf.repeat(
self._encode(at[..., None, :, :]), self._sample_size, axis=-3
Copy link
Collaborator

Choose a reason for hiding this comment

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

any reason not to encode first thing?

at = self._encode(at)

samples = tf.repeat(at[..., None, :, :], self._sample_size, axis=-3)  # [..., S, 1, D]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mainly compactness.

@@ -72,6 +72,7 @@ def __init__(self, sample_size: int, model: GPfluxPredictor):
)
for _ in range(len(self._model_gpflux.f_layers))
]
self._encode = lambda x: model.encode(x)
Copy link
Collaborator

Choose a reason for hiding this comment

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

out of curiosity, does the following work?

Suggested change
self._encode = lambda x: model.encode(x)
self._encode = model.encode

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I think it does.

@avullo avullo merged commit ba65aea into develop Sep 18, 2024
12 checks passed
@avullo avullo deleted the alessandro/dgp-with-encoders branch September 18, 2024 08:03
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