branin
Branin objective function, relying on the botorch implementation.
This code is based on the implementation by Nikita Saxena (nikita-0209) in https://github.com/alexhernandezgarcia/activelearning
The implementation assumes by default that the inputs will be on [-1, 1] x [-1, 1] and will be mapped to the standard domain of the Branin function (see X1_DOMAIN and X2_DOMAIN). Setting do_domain_map to False will prevent the mapping.
Branin function is typically used as a minimization problem, with the minima around zero but positive. By default, proxy values remain in this range and the reward is mapped to (~0, UPPER_BOUND_IN_DOMAIN). The user should carefully select the reward function in order to stick to the conventional use of the Branin function.
Attributes
Classes
Module Contents
- class branin.Branin(fidelity=1.0, do_domain_map=True, negate=False, reward_function=lambda x: ..., **kwargs)[source]
Bases:
gflownet.proxy.base.Proxy- Parameters:
fidelity (float) – Fidelity of the Branin oracle. 1.0 corresponds to the original Branin. Smaller values (up to 0.0) reduce the fidelity of the oracle.
do_domain_map (bool) – If True, the states are assumed to be in [-1, 1] x [-1, 1] and are re-mapped to the standard domain before calling the botorch method. If False, the botorch method is called directly on the states values.
negate (bool) – If True, proxy values are multiplied by -1.
reward_function (str or Callable) – The transformation applied to the proxy outputs to obtain a GFlowNet reward. By default, proxy values are shifted by UPPER_BOUND_IN_DOMAIN and multiplied by minus one, in order to make them positive and the higher the better.
- __call__(states)[source]
Implement this function to call the get_reward method of the appropriate Proxy Class (EI, UCB, Proxy, Oracle etc).
- Parameters:
states (ndarray)
- Return type:
torchtyping.TensorType[batch]
- map_to_standard_domain(states)[source]
Maps a batch of input states onto the domain typically used to evaluate the Branin function. See X1_DOMAIN and X2_DOMAIN. It assumes that the inputs are on [-1, 1] x [-1, 1].
- Parameters:
states (torchtyping.TensorType[batch, 2])
- Return type:
torchtyping.TensorType[batch, 2]