[docs]classInverseGamma(TransformedDistribution):r""" Creates an inverse gamma distribution parameterized by :attr:`concentration` and :attr:`rate` where:: X ~ Gamma(concentration, rate) Y = 1 / X ~ InverseGamma(concentration, rate) Example:: >>> # xdoctest: +IGNORE_WANT("non-deterinistic") >>> m = InverseGamma(torch.tensor([2.0]), torch.tensor([3.0])) >>> m.sample() tensor([ 1.2953]) Args: concentration (float or Tensor): shape parameter of the distribution (often referred to as alpha) rate (float or Tensor): rate = 1 / scale of the distribution (often referred to as beta) """arg_constraints={"concentration":constraints.positive,"rate":constraints.positive,}support=constraints.positivehas_rsample=Truedef__init__(self,concentration,rate,validate_args=None):base_dist=Gamma(concentration,rate,validate_args=validate_args)neg_one=-base_dist.rate.new_ones(())super().__init__(base_dist,PowerTransform(neg_one),validate_args=validate_args)
To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.