branin ====== .. py:module:: branin .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: branin.X1_DOMAIN branin.X1_LENGTH branin.X2_DOMAIN branin.X2_LENGTH branin.UPPER_BOUND_IN_DOMAIN branin.OPTIMUM branin.MODES Classes ------- .. autoapisummary:: branin.Branin Module Contents --------------- .. py:data:: X1_DOMAIN .. py:data:: X1_LENGTH :value: 15 .. py:data:: X2_DOMAIN :value: [0, 15] .. py:data:: X2_LENGTH :value: 15 .. py:data:: UPPER_BOUND_IN_DOMAIN :value: 309 .. py:data:: OPTIMUM :value: 0.397887 .. py:data:: MODES :value: [[12.4, 81.833], [54.266, 15.16], [94.98, 16.5]] .. py:class:: Branin(fidelity = 1.0, do_domain_map = True, negate = False, reward_function = lambda x: -1.0 * (x - UPPER_BOUND_IN_DOMAIN), **kwargs) Bases: :py:obj:`gflownet.proxy.base.Proxy` :param fidelity: Fidelity of the Branin oracle. 1.0 corresponds to the original Branin. Smaller values (up to 0.0) reduce the fidelity of the oracle. :type fidelity: float :param do_domain_map: 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. :type do_domain_map: bool :param negate: If True, proxy values are multiplied by -1. :type negate: bool :param reward_function: 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. :type reward_function: str or Callable :param See: :type See: https://botorch.org/api/test_functions.html .. py:attribute:: fidelity :value: 1.0 .. py:attribute:: do_domain_map :value: True .. py:attribute:: function_mf_botorch .. py:attribute:: domain_left .. py:attribute:: domain_length .. py:method:: __call__(states) Implement this function to call the get_reward method of the appropriate Proxy Class (EI, UCB, Proxy, Oracle etc). :param states: :type states: ndarray .. py:method:: map_to_standard_domain(states) 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].