-
Notifications
You must be signed in to change notification settings - Fork 46
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
Uri/remove negate argument #480
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
if isinstance(function, TrajectoryFunctionClass): | ||
# we want to negate the trajectory function but otherwise leave it alone, | ||
# as it may have e.g. update and resample methods | ||
|
||
class NegatedTrajectory(type(function)): # type: ignore[misc] | ||
def __call__(self, x: TensorType) -> TensorType: | ||
return -1.0 * super().__call__(x) | ||
|
||
function.__class__ = NegatedTrajectory | ||
else: | ||
|
||
def negated_trajectory(x: TensorType) -> TensorType: | ||
return -1.0 * function(x) | ||
|
||
function = negated_trajectory | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clever!
@@ -348,15 +347,12 @@ def test_rff_trajectory_sampler_can_return_negative_trajectory(negate: bool) -> | |||
) # need a gpflow kernel object for random feature decompositions | |||
|
|||
sampler = RandomFourierFeatureTrajectorySampler(model, num_features=100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not executed by the new continuous TS so I dont see why would trajectory be negated, by default it should be positive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
essentially this does not test that a negative trajectory can be returned - this should probably be moved to the cont TS test file and tested there properly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @henrymoss noted, this test no longer doing anything useful, so I've removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I think I have hit the approve to soon, that test doesn't look good anymore to me (see comments above)
Remove the negate argument from get_trajectory by having GreedyContinuousThompsonSampling update the callable trajectory to negate it.