Custom distributions

Implementations of custom distributions.

class ecgan.utils.distributions.TruncatedNormal(mu=0.0, sigma=1.0, lower_limit=- 2.0, upper_limit=2.0)[source]

Bases: object

Sample from a normal distribution truncated to lie within an upper and a lower limit a and b.

Inspired by https://discuss.pytorch.org/t/implementing-truncated-normal-initializer/4778/20.

Parameters
  • mu (float) -- Mean of the parent normal distribution to sample from.

  • sigma (float) -- Standard deviation of the parent normal distribution to sample from.

  • lower_limit (float) -- Lower threshold of the truncated distribution.

  • upper_limit (float) -- Upper threshold of the truncated distribution.

sample(shape)[source]

Generate uniform random variable and apply inverse CDF.