11 Samples from a Pareto Type 1 distribution. 15 >>> m = Pareto(torch.tensor([1.0]), torch.tensor([1.0])) 16 >>> m.sample() # sample from a Pareto distribution with scale=1 and alpha=1 20 scale (float or Tensor): Scale parameter of the distribution 21 alpha (float or Tensor): Shape parameter of the distribution 23 arg_constraints = {
'alpha': constraints.positive,
'scale': constraints.positive}
25 def __init__(self, scale, alpha, validate_args=None):
26 self.scale, self.
alpha = broadcast_all(scale, alpha)
29 super(Pareto, self).__init__(base_dist, transforms, validate_args=validate_args)
31 def expand(self, batch_shape, _instance=None):
33 new.scale = self.scale.expand(batch_shape)
34 new.alpha = self.alpha.expand(batch_shape)
35 return super(Pareto, self).expand(batch_shape, _instance=new)
40 a = self.alpha.clone().clamp(min=1)
41 return a * self.scale / (a - 1)
46 a = self.alpha.clone().clamp(min=2)
47 return self.scale.pow(2) * a / ((a - 1).pow(2) * (a - 2))
49 @constraints.dependent_property
51 return constraints.greater_than(self.scale)
54 return ((self.scale / self.
alpha).log() + (1 + self.alpha.reciprocal()))
def _get_checked_instance(self, cls, _instance=None)