pytorch
b014d4dd - Add transformation using cdf of distribution. (#72495)

Commit
2 years ago
Add transformation using cdf of distribution. (#72495) Summary: This PR adds a transform that uses the cumulative distribution function of a given probability distribution. For example, the following code constructs a simple Gaussian copula. ```python # Construct a Gaussian copula from a multivariate normal. base_dist = MultivariateNormal( loc=torch.zeros(2), scale_tril=LKJCholesky(2).sample(), ) transform = CumulativeDistributionTransform(Normal(0, 1)) copula = TransformedDistribution(base_dist, [transform]) ``` The following snippet creates a "wrapped" Gaussian copula for correlated positive variables with Weibull marginals. ```python transforms = [ CumulativeDistributionTransform(Normal(0, 1)), CumulativeDistributionTransform(Weibull(4, 2)).inv, ] wrapped_copula = TransformedDistribution(base_dist, transforms) ``` cc fritzo Pull Request resolved: https://github.com/pytorch/pytorch/pull/72495 Reviewed By: ejguan Differential Revision: D34085919 Pulled By: albanD fbshipit-source-id: 7917391519a96b0d9b54c52db65d1932f961d070 (cherry picked from commit 572196146ede48a279828071941f6eeb8fc98a56)
Author
Committer
Parents
Loading