fast_lisa_subtraction.priors.copulas module

class fast_lisa_subtraction.priors.copulas.Copula_[source]

Bases: object

Apply copulas to samples from marginal distributions.

classmethod clayton_copula(x, y, theta, eps=1e-12)[source]

Apply a Clayton copula to two marginal samples.

Parameters:
  • x (torch.Tensor) – Samples from the first marginal distribution.

  • y (torch.Tensor) – Samples from the second marginal distribution.

  • theta (float) – Copula parameter (must be positive).

  • eps (float, optional) – Clamp value for numerical stability.

Returns:

Transformed samples with Clayton dependence.

Return type:

tuple of torch.Tensor

static empirical_cdf(x)[source]

Compute the empirical CDF of a 1D tensor.

Parameters:

x (torch.Tensor) – Input samples.

Returns:

(sorted_x, cdf) where cdf is the empirical cumulative distribution at each sorted value.

Return type:

tuple of torch.Tensor

classmethod frank_copula(x, y, k)[source]

Apply a Frank copula to two marginal samples.

Parameters:
  • x (torch.Tensor) – Samples from the first marginal distribution.

  • y (torch.Tensor) – Samples from the second marginal distribution.

  • k (float) – Copula correlation parameter.

Returns:

Transformed samples with Frank dependence.

Return type:

tuple of torch.Tensor

classmethod gaussian_copula(x, y, rho)[source]

Apply a Gaussian copula to two marginal samples.

Parameters:
  • x (torch.Tensor) – Samples from the first marginal distribution.

  • y (torch.Tensor) – Samples from the second marginal distribution.

  • rho (float) – Correlation coefficient between the marginals.

Returns:

Transformed samples with Gaussian-copula dependence.

Return type:

tuple of torch.Tensor

static quantile(x, u)[source]

Compute empirical quantiles for 1D tensors.

Parameters:
  • x (torch.Tensor) – Input samples.

  • u (torch.Tensor) – Quantile probabilities in [0, 1].

Returns:

Quantile values corresponding to u.

Return type:

torch.Tensor

classmethod student_t_copula(x, y, rho, df, eps=1e-07)[source]

Apply a Student’s t copula to two marginal samples.

Parameters:
  • x (torch.Tensor) – Samples from the first marginal distribution.

  • y (torch.Tensor) – Samples from the second marginal distribution.

  • rho (float) – Correlation coefficient between the marginals.

  • df (float) – Degrees of freedom for the t distribution.

  • eps (float, optional) – Clamp value to keep uniforms within (0, 1).

Returns:

Transformed samples with Student’s t dependence.

Return type:

tuple of torch.Tensor