corners ======= .. py:module:: corners .. autoapi-nested-parse:: Corners objective function, defined for box-like environments, such as the hyper-grid and the cube. The function places high scores in all corners of the hyper-box according to either of these options: - A mixture of Gaussians. Optionally, the scores and can be thresholded in order to make the task harder. - A hard-coded function that assigns each point of the hyper-box to one of three scores (this matches the function used in the original GFlowNets paper): - High scores: points in the corners at a distance from the edge between 0.2 and 0.1 the length of the box. - Middle scores: points in the corners at distance from the edge within a quarter the length of the box. - Low scores: all other points. Classes ------- .. autoapisummary:: corners.Corners Module Contents --------------- .. py:class:: Corners(n_dim=None, mu=None, sigma=None, do_gaussians=True, do_threshold=False, thresholds = ((0.0, 2.0, 1e-06), (2.0, 3.0, 2.0), (3.0, 100, 10.0)), scores = [2.0, 0.5, 0.01], **kwargs) Bases: :py:obj:`gflownet.proxy.base.Proxy` Initializes an instance of the Corners proxy. :param n_dim: Dimensionality of the hyper-box. :type n_dim: int :param mu: Mean of the Gaussian distributions that make the objective function. It should be a value between 0.0 and 1.0. A value closer to 1.0 places the regions of high scores closer to the edges (in the corners) and a value closer to 0.0 places the regions of high scores closer to the center. :type mu: float :param sigma: Standard deviation of the Gaussian distributions that make the objective function. :type sigma: float :param do_gaussians: If True, the score landscape is modelled by a mixture of Gaussians. Otherwise, the scores are assigned via an indicator function, as in the original GFlowNets paper. :type do_gaussians: bool :param do_threshold: If True, the values of the Gaussians are thresholded using the values in ``thresholds``. :type do_threshold: bool :param thresholds: A list of tuples with the information to threshold the objective function. The first two values of the tuple indicate the lower and upper bound of a range, and the third value indicates the value onto which values in the range are mapped. For example, (0.0, 1.0, 1e-6) will map all values between 0.0 and 1.0 to 1e-6. :type thresholds: iterable :param scores: The scores of the three regions for the non-Gaussian version. It should be a list with three elements, where the first element is highest score, the second element the middle score and the third element the lowest score. :type scores: iterable .. py:attribute:: n_dim :value: None .. py:attribute:: mu :value: None .. py:attribute:: sigma :value: None .. py:attribute:: do_gaussians :value: True .. py:attribute:: do_threshold :value: False .. py:attribute:: thresholds .. py:attribute:: scores :value: (2.0, 0.5, 0.01) .. py:method:: setup(env=None) .. py:property:: optimum Returns the optimum value of the proxy. Not implemented by default but may be implemented for synthetic proxies or when the optimum is known. The optimum is used, for example, to accelerate rejection sampling, to sample from the reward function. .. 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