optora.divergences.max_divergence¶
Max-divergence (Renyi divergence of order infinity) between distributions.
MaxDivergence
¶
Bases: Divergence
Max-divergence of a candidate distribution from a reference.
For discrete distributions represented as nonnegative tensors that sum to one along their last dimension, computes the logarithm of the largest likelihood ratio,
the Renyi divergence of order \(\infty\) (van Erven and Harremoes 2014),
also called the max-divergence (Dwork and Roth 2014). It is infinite
when p puts mass where q has none, and the clamp described below
replaces that infinity by a large finite value. Its ball of radius
\(\log(1/\alpha)\) is exactly the set of distributions with likelihood
ratio at most \(1/\alpha\), which optora.dro.phi_dro.CVaRAmbiguitySet
uses to express conditional value-at-risk as an ambiguity set.
Attributes:
| Name | Type | Description |
|---|---|---|
eps |
Small positive constant used to clamp |
__init__(eps=1e-12)
¶
Initialize the max-divergence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eps
|
float
|
Small positive constant used to clamp |
1e-12
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
forward(p, q)
¶
Compute the max-divergence of p from q.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
Tensor
|
Candidate distribution of shape |
required |
q
|
Tensor
|
Reference distribution of shape |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
\(D_\infty(p \,\|\, q)\) over the broadcast batch, of shape |
Tensor
|
|
Tensor
|
error near zero, computed in |
Tensor
|
and returned in the promoted dtype of |