ISubGVQA.sampling.methods.noise =============================== .. py:module:: ISubGVQA.sampling.methods.noise Attributes ---------- .. autoapisummary:: ISubGVQA.sampling.methods.noise.logger Classes ------- .. autoapisummary:: ISubGVQA.sampling.methods.noise.BaseNoiseDistribution ISubGVQA.sampling.methods.noise.SumOfGammaNoiseDistribution ISubGVQA.sampling.methods.noise.GumbelDistribution Module Contents --------------- .. py:data:: logger .. py:class:: BaseNoiseDistribution Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:method:: sample(shape: torch.Size) -> torch.Tensor :abstractmethod: .. py:class:: SumOfGammaNoiseDistribution(k: float, nb_iterations: int = 10, device: Optional[torch.device] = None) Bases: :py:obj:`BaseNoiseDistribution` Creates a generator of samples for the Sum-of-Gamma distribution [1], parameterized by :attr:`k`, :attr:`nb_iterations`, and :attr:`device`. [1] Mathias Niepert, Pasquale Minervini, Luca Franceschi - Implicit MLE: Backpropagating Through Discrete Exponential Family Distributions. NeurIPS 2021 (https://arxiv.org/abs/2106.01798) Example:: >>> import torch >>> noise_distribution = SumOfGammaNoiseDistribution(k=5, nb_iterations=100) >>> noise_distribution.sample(torch.Size([5])) tensor([ 0.2504, 0.0112, 0.5466, 0.0051, -0.1497]) Args: k (float): k parameter -- see [1] for more details. nb_iterations (int): number of iterations for estimating the sample. device (torch.devicde): device where to store samples. .. py:attribute:: k .. py:attribute:: nb_iterations :value: 10 .. py:attribute:: device :value: None .. py:method:: sample(shape: torch.Size) -> torch.Tensor .. py:class:: GumbelDistribution(loc: float = 0.0, scale: float = 1.0, device: torch.device = 'cpu') Bases: :py:obj:`BaseNoiseDistribution` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: loc :value: 0.0 .. py:attribute:: _scale :value: 1.0 .. py:attribute:: device :value: 'cpu' .. py:property:: scale .. py:method:: sample(shape: torch.Size) -> torch.Tensor