Unexpected behaviour of InverseCostWeightedUtility for negative AF values #2194
Unanswered
AlexanderMouton
asked this question in
Q&A
Replies: 1 comment 4 replies
-
|
Sorry for the delayed response here @AlexanderMouton - I haven't thought through this in too much detail, but I think this fix makes sense to me. cc @SebastianAment, @dme65, @sdaulton re MF. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am doing research on multi-fidelity BO using the
qMultiFidelityKnowledgeGradientacquisition function (AF). Building on discussion 1977, negative AF values can arise if the KG AF isn't optimised perfectly.The
InverseCostWeightedUtilityscales the AF values of candidate vectors based on their cost. An excerpt of the source code:.... # clamp (away from zero) and sum cost across elements of the q-batch - # this will be of shape `num_fantasies x batch_shape` or `batch_shape` cost = cost.clamp_min(self._min_cost).sum(dim=-1) # if we are doing inverse weighting on the sample level, clamp numerator. if not self._use_mean: deltas = deltas.clamp_min(0.0) # compute and return the ratio on the sample level - If `use_mean=True` # this operation involves broadcasting the cost across fantasies return deltas / costThis works fine for positive AF values, for example:
(delta, cost) -> cost-weighted AF value
(0.5, 10) -> 0.05
(0.5, 5) -> 0.25
In other words, a cheaper candidate with the same AF value will result in a higher AF value.
But when the maximising AF value is negative:
(delta, cost) -> cost-weighted AF value
(-0.5, 10) -> -0.05
(-0.5, 5) -> -0.25
The more costly candidate (with the same AF value) has a higher AF value, which is counterintuitive.
I ran into this issue when I saw that my MFBO algorithm almost always selected the next point to evaluate at the highest fidelity when the maximising AF value was negative.
My suggestion to easily fix this is to instead multiply the
deltasby the cost if they are negative, i.e:(delta, cost) -> cost-weighted AF value
(0.5, 10) -> 0.5/10 -> 0.05
(0.5, 5) -> 0.5/5 -> 0.25
(-0.5, 10) -> -0.5*10 -> -5.0
(-0.5, 5) -> -0.5*5 -> -2.5
In the source code this would look like:
.... # clamp (away from zero) and sum cost across elements of the q-batch - # this will be of shape `num_fantasies x batch_shape` or `batch_shape` cost = cost.clamp_min(self._min_cost).sum(dim=-1) # if we are doing inverse weighting on the sample level, clamp numerator. if not self._use_mean: deltas = deltas.clamp_min(0.0) # compute and return the ratio on the sample level - If `use_mean=True` # this operation involves broadcasting the cost across fantasies return torch.where(deltas > 0, deltas / cost, deltas * cost)*Note that
self._use_meanisTruewhen following the same setup as in the MFKG tutorial, sodeltaswon't be clamped to be > 0.Beta Was this translation helpful? Give feedback.
All reactions