dit.rate_distortion
Various implementations of rate-distortion theory.
Classes
The deterministic information bottleneck objective. |
|
A point of the extension profile. |
|
The extension profile of a pair and its distinguished points. |
|
The generalized information bottleneck family. |
|
Compute the common-rate vs total-private-rate trade-off curve. |
|
The generalized Gray-Wyner network for a source distribution. |
|
Minimize a weighted sum of Gray-Wyner rates over the common auxiliary variable |
|
Compute an information bottleneck curve. |
|
Base optimizer for information bottleneck type calculations. |
|
A generalized information bottleneck which uses a distortion equal to D( p(Y|x) || q(Y|t) ) for an arbitrary divergence measure D. |
|
The information bottleneck at a fixed rate [TPB00], |
|
A point of the mutual information region of [LEG18a]. |
|
Compute a privacy funnel curve [MSFMedard14]: the least leakage |
|
The privacy funnel Lagrangian [MSFMedard14], |
|
The privacy funnel [MSFMedard14], |
|
The result of a finite-alphabet privacy funnel optimization. |
|
Compute a rate-distortion curve. |
|
The shape function of a tuple of random variables. |
|
A point of the region of tension. |
Functions
Determine whether X can be released with non-zero utility and zero leakage about S. |
|
Compute the asymmetric private interaction information. |
|
The excess functional information [LEG18b] |
|
Convert extension-profile coordinates back to a Gray-Wyner rate point. |
|
Greedily merge released symbols for the privacy funnel [MSFMedard14]. |
|
Construct a |
|
Compute the information bottleneck at a fixed rate: the largest relevance |
|
Körner's graph entropy [Korner73] of the characteristic graph of \(X\) (two values are adjacent when some \(y\) is compatible with both), |
|
The lossy Wyner common information |
|
Compute the maximal interaction information. |
|
Convert mutual information coordinates back to a Gray-Wyner rate point. |
|
Compute the maximal utility at perfect privacy, |
|
Compute a point on the privacy funnel by minimizing |
|
Compute the privacy funnel, the least leakage |
|
Convert a Gray-Wyner rate point to extension-profile coordinates. |
|
Convert a Gray-Wyner rate point to mutual information coordinates. |
|
Convert a Gray-Wyner rate point to tension coordinates. |
|
Compute the symmetric private interaction information. |
|
Convert tension coordinates back to a Gray-Wyner rate point. |
Reference
- class DeterministicInformationBottleneck(dist, beta, alpha=0.0, rvs=None, crvs=None, bound=None)[source]
Bases:
GeneralizedInformationBottleneckThe deterministic information bottleneck objective.
This is the
alpha=0endpoint of the generalized information bottleneck, using \(H(T | Z)\) as the compression term.
- class ExtensionPoint(conditional_entropies, residual)
Bases:
tupleA point of the extension profile.
- class ExtensionProfile(dist, rvs=None, bound=None, rng=None)[source]
Bases:
objectThe extension profile of a pair and its distinguished points.
The lower boundary is sampled over every downward direction \((\alpha, \beta, -1)\), written as \(\alpha + i\beta = r e^{i\theta}\); for each \(\theta\) the optimum is continued along \(r\) (from \(r \to 0\), the rim of the bottom face \(I[X:Y|W] = 0\), to \(r \to \infty\), the silhouette), then every grid point is re-solved from its neighbours until none improves. Points with negligible \(I[X:Y|W]\) are snapped to the bottom face. The upper boundary is sampled over upward directions. All of these are attained points, so their hull is an inner approximation of the body.
- Parameters:
dist (Distribution) – The distribution of interest.
rvs (list of lists, None) – The two variables
[X, Y]. If None, the two variables of dist.bound (int, None) – Cardinality of the auxiliary W in the boundary optimizations. If None,
min(support + 2, 8).rng (int, numpy.random.Generator, None) – Seed or generator for the optimizers’ random starts.
- support_point(direction, starts=8)[source]
A point of the extension profile maximizing
direction . (x, y, z).- Parameters:
direction (array-like) – The direction (any length; it need not be normalized).
starts (int) – Number of random starts.
- Returns:
point – The supporting point
(H[X|W], H[Y|W], I[X:Y|W]).- Return type:
np.ndarray
- lower_boundary(num_theta=48, num_radii=33, r_min=1e-05, r_max=1000.0, max_passes=6)[source]
Sample the lower (downward-facing) boundary.
- Parameters:
num_theta (int) – Number of angles round the circle.
num_radii (int) – Number of radii, geometrically spaced in
[r_min, r_max].r_min (float) – The radial range; small radii resolve the bottom-face rim.
r_max (float) – The radial range; small radii resolve the bottom-face rim.
max_passes (int) – Maximum neighbour-relaxation passes.
- Returns:
points – Shape
(num_theta, num_radii, 3).- Return type:
np.ndarray
- upper_boundary(num=300, starts=4)[source]
Sample the upper (upward-facing) boundary in num directions.
- Returns:
points – Shape
(m, 3).- Return type:
np.ndarray
- relaxed_wyner(num=25)[source]
The relaxed-Wyner curve [GS19]: the diagonal alpha = beta in (0, 1/2].
- beta_common(betas=None, niter=None)[source]
Realizer points of the beta-common information [YLC17] for each beta.
- information_bottleneck(num=60)[source]
Both information-bottleneck arcs [LEG18a, TPB00]: the lower arcs of the zero-leakage faces
x - z = H[X|Y](U generated from Y) and its mirror, from W = const to the Kamath point.- Returns:
arcs –
[X -> Y, Y -> X].- Return type:
list of np.ndarray
- privacy_funnel(num=60)[source]
Both privacy-funnel arcs [LEG18a, MSFMedard14]: the upper arcs of the zero-leakage faces, from W = Y (or X) to perfect privacy.
- Returns:
arcs –
[X -> Y, Y -> X].- Return type:
list of np.ndarray
- public_channel_synthesis(lower, num=45)[source]
The communication rate for distributed channel synthesis over a public channel with common-randomness rate
t[Cuf13],\[C_{pub}(t, X \to Y) = \min_{X - U - Y,\ I[XY:U] \le t} I[X:U].\]The public message must look independent of the synthesized pair, so the common randomness must cover all of \(I[XY:U]\): the curve starts at the Wyner point,
tequal to the Wyner common information, and reachesC = I[X:Y]atU = Y, wheret = H[Y]. In the mutual information region it is the lower edge of the bottom face’s projection onto the \((I[X:U], I[XY:U])\) plane.- Parameters:
lower (np.ndarray) – Lower-boundary points (from lower_boundary); their
z = 0subset gives the rim.num (int) – Number of values of
t.
- Returns:
ts (np.ndarray) – The common-randomness rates.
curves (list of (np.ndarray, np.ndarray)) –
[(values, points) for X -> Y, (values, points) for Y -> X].
- channel_synthesis(lower, num=45)[source]
The communication rate for distributed channel synthesis with common-randomness rate
t[Cuf13, LEG18a],\[C(t, X \to Y) = \min_{X - U - Y} \max\{I[X:U],\ I[XY:U] - t\},\]a minimization over the bottom face of the extension profile. Its optimal
Uruns along the bottom-face rim from the Wyner point (t = 0) towards the Kamath point, whereC(t) = I[X:Y]. This interpolates the rim for plotting; for the rate at a singlet, optimized directly, use dit.multivariate.channel_synthesis_rate.In region-of-tension coordinates, \(I[X:U] = I[X:Y] + \tau_2\) and the common randomness used at a corner point is \(I[Y:U|X] = \tau_1\), so \(C(t) = I[X:Y] + \min_{\tau_3 = 0} \{\tau_2 + (\tau_1 - t)^+\}\). The decoder needs local randomness \(H[Y|U]\), the extension-profile
ycoordinate.- Parameters:
lower (np.ndarray) – Lower-boundary points (from lower_boundary); their
z = 0subset gives the rim.num (int) – Number of values of
t, from 0 to a little past the rate at whichC(t) = I[X:Y](the necessary conditional entropy).
- Returns:
ts (np.ndarray) – The common-randomness rates.
curves (list of (np.ndarray, np.ndarray)) –
[(values, points) for X -> Y, (values, points) for Y -> X].
- compute(lower=None, upper=None, curves=None, slow=True, niter=None)[source]
Compute the boundary and every distinguished point.
- Parameters:
lower (dict, None) – Keyword arguments for lower_boundary, upper_boundary and the arc methods (
num).upper (dict, None) – Keyword arguments for lower_boundary, upper_boundary and the arc methods (
num).curves (dict, None) – Keyword arguments for lower_boundary, upper_boundary and the arc methods (
num).slow (bool) – Whether to run the non-convex realizer optimizations (Wyner, exact, beta).
niter (int, None) – Basin hops for those optimizations.
- Returns:
features – Everything plot_extension_profile draws.
- Return type:
- plot(features=None, **kwargs)[source]
Draw the extension profile with Plotly. See plot_extension_profile.
- class GeneralizedInformationBottleneck(dist, beta, alpha=1.0, rvs=None, crvs=None, bound=None)[source]
Bases:
InformationBottleneckThe generalized information bottleneck family.
The parameter
alphainterpolates between the standard information bottleneck (alpha=1) and the deterministic information bottleneck (alpha=0).
- class GrayWynerCurve(dist, rvs=None, crvs=None, distortions=None, distortion_bounds=None, s_min=0.0, s_max=4.0, s_num=21, niter=None, maxiter=1000, bound=None)[source]
Bases:
objectCompute the common-rate vs total-private-rate trade-off curve.
- class GrayWynerNetwork(dist, rvs=None, crvs=None, distortions=None, distortion_bounds=None, bound=None)[source]
Bases:
objectThe generalized Gray-Wyner network for a source distribution.
- Parameters:
dist (Distribution) – The source distribution.
rvs (list of lists, None) – The source groups
X_1, ..., X_n. If None, each variable of dist is its own source.crvs (list, None) – Variables to condition the network on. If None, none.
distortions (list, None) – Per-decoder distortion matrices, or None entries for lossless decoders. If None, every decoder is lossless.
distortion_bounds (list, None) – Per-decoder distortion budgets
D_i. If None, all zero (lossless).bound (int, None) – Optional cap on the cardinality of the common auxiliary
W.
- rate_point(lambdas, niter=None, maxiter=1000, polish=1e-06, rng=None, **kwargs)[source]
Compute the Gray-Wyner rate point supporting a weight vector.
- Parameters:
lambdas (iterable of float) – The weights
(lambda_0, lambda_1, ..., lambda_n).niter (int, None) – Number of basin hops.
maxiter (int) – Inner optimizer iterations.
polish (float) – Polishing cutoff; if falsey, no polishing.
kwargs (dict) – Additional keyword arguments for GrayWynerOptimizer, such as
allow_signedorrate_equalities.
- Returns:
point – The supporting
(common, private)rate point.- Return type:
- region(num=20, niter=None, maxiter=1000, rng=None)[source]
Sample the lower boundary of the achievable rate region.
Weight vectors are drawn on the
(n + 1)-simplex (the vertices, plus random Dirichlet samples) and the supporting rate point of each is computed.- Parameters:
- Returns:
points – The sampled boundary points.
- Return type:
- tension_point(lambdas, **kwargs)[source]
Compute a point of the region of tension supporting a weight vector.
- Parameters:
lambdas (iterable of float) – The Gray-Wyner weights
(lambda_0, lambda_1, ..., lambda_n).kwargs (dict) – Additional keyword arguments for
rate_point().
- Returns:
point – The supporting point, in tension coordinates.
- Return type:
- tension_region(num=20, niter=None, maxiter=1000, rng=None)[source]
Sample the lower boundary of the region of tension.
The region proper is the increasing hull of the attainable tension points [PP14]; the points returned here are attainable ones on its lower boundary.
- Parameters:
- Returns:
points – The sampled boundary points.
- Return type:
list of TensionPoint
- extension_profile(num=20, niter=None, maxiter=1000, rng=None)[source]
Sample the lower boundary of the extension profile.
The extension profile [MR26a] records
(H[X_i | W], ..., T[X_{0:n} | W]); for a pair this is the(H[X|W], H[Y|W], I[X:Y|W])body of that reference.- Parameters:
- Returns:
points – The sampled boundary points.
- Return type:
- mutual_information_region(num=20, niter=None, maxiter=1000, rng=None)[source]
Sample the lower boundary of the mutual information region.
The mutual information region [LEG18a] records
(I[X_i : W], ..., I[X_{0:n} : W]). Unlike the region of tension, which tensorizes exactly, this region is only superadditive.- Parameters:
- Returns:
points – The sampled boundary points.
- Return type:
- tension_intercepts(niter=None, maxiter=1000)[source]
The axis intercepts of the region of tension.
These are the
T_iof [PP14] (their equation 1): the smallest value each coordinate can take when every other coordinate is zero. They are constrained optima rather than supporting-hyperplane queries.The residual intercept satisfies
T_res = I[X:Y] - K[X:Y], which is the Gacs-Korner corollary of [PP14] (their Corollary 3.3); the source intercepts are the Wolf-Wullschleger monotones.
- corner_points(niter=None, maxiter=1000)[source]
The named common-information operating points of the network.
For a lossless network the corners are the standard common informations, computed by delegating to their canonical implementations so the values stay consistent across dit. The returned values are the common-rate (
R_0) coordinates of those operating points.
- class GrayWynerOptimizer(dist, lambdas, rvs=None, crvs=None, distortions=None, distortion_bounds=None, markov=False, bound=None, allow_signed=False, rate_equalities=None)[source]
Bases:
BaseAuxVarOptimizerMinimize a weighted sum of Gray-Wyner rates over the common auxiliary variable
W(and reconstruction test channels for lossy decoders).- compute_bound()[source]
Caratheodory-style cardinality bound on
W.The Fenchel-Eggleston strengthening of Caratheodory’s theorem gives
|W| <= |X_1| ... |X_n| + 2: the joint pmf must be preserved (prod - 1constraints) and the rate point itself contributes the remaining degrees of freedom. This is the bound used throughout the assisted-common-information literature [LEG18a, PP14].- Returns:
bound – The bound on the alphabet size of
W.- Return type:
- optimize(x0=None, niter=None, maxiter=None, polish=1e-06, callback=False, rng=None)[source]
Perform the optimization, including the deterministic probe seeds.
- Parameters:
x0 (np.ndarray, None) – The vector to initialize the optimization with.
niter (int, None) – The number of basin hops to perform.
maxiter (int, None) – The number of inner optimizer steps to perform.
polish (False, float) – Whether to polish the result.
callback (bool) – Whether to utilize a callback or not.
- Returns:
result – The result of the optimization.
- Return type:
OptimizeResult, None
- class IBCurve(dist, rvs=None, crvs=None, beta_min=0.0, beta_max=15.0, beta_num=101, alpha=1.0, method='sp', divergence=None, variant=None, bound=None)[source]
Bases:
objectCompute an information bottleneck curve.
- compute(method='sp')[source]
Sweep beta and compute the information bottleneck curve.
- Parameters:
method ({'sp', 'ba', 'sequential', 'agglomerative'}) – The method of computation to use. ‘sp’ denotes scipy.optimize; ‘ba’ denotes blahut-arimoto; ‘sequential’ and ‘agglomerative’ denote hard deterministic solvers.
- find_max_beta()[source]
Find a beta value which maximizes the rate.
- Returns:
beta_max – The the smallest found beta value which achieves minimal distortion.
- Return type:
- class InformationBottleneck(dist, beta, alpha=1.0, rvs=None, crvs=None, bound=None)[source]
Bases:
BaseAuxVarOptimizerBase optimizer for information bottleneck type calculations.
- optimize(*args, **kwargs)[source]
Optimize, then keep the best of the result, the seeds, and the deterministic partition encoders, since local search started at a seed can drift away from it.
- Parameters:
args – Passed to
BaseAuxVarOptimizer.optimize().kwargs – Passed to
BaseAuxVarOptimizer.optimize().
- Returns:
result – The result of the search.
- Return type:
OptimizeResult
- class InformationBottleneckDivergence(dist, beta, alpha=1.0, divergence=<function relative_entropy_pmf>, rvs=None, crvs=None, bound=None)[source]
Bases:
InformationBottleneckA generalized information bottleneck which uses a distortion equal to D( p(Y|x) || q(Y|t) ) for an arbitrary divergence measure D.
- class InformationBottleneckRate(dist, rate, rvs=None, crvs=None, bound=None)[source]
Bases:
InformationBottleneckThe information bottleneck at a fixed rate [TPB00],
\[F(R) = \max_{p(t | x, z) : I[X : T | Z] \leq R} I[Y : T | Z],\]the information bottleneck curve as a function of the complexity. The curve is concave and non-decreasing, and reaches
I[X : Y | Z]. A rate constraint needs one symbol more than the Lagrangian, so the size of T is bounded by|X||Z| + 1.- optimize(*args, **kwargs)[source]
Optimize a few times, then keep the most relevant feasible candidate among the results, the seeds, and the deterministic encoders.
- Parameters:
args – Passed to
BaseAuxVarOptimizer.optimize().kwargs – Passed to
BaseAuxVarOptimizer.optimize().
- Returns:
result – The result of the search.
- Return type:
OptimizeResult
- class MutualInformationPoint(marginals, joint)
Bases:
tupleA point of the mutual information region of [LEG18a].
- class PFCurve(dist, rvs=None, crvs=None, rate_num=26, method='sp', bound=None)[source]
Bases:
objectCompute a privacy funnel curve [MSFMedard14]: the least leakage
I[S : T | Z]of a release T of X as a function of its utilityI[X : T | Z]. It is the lower boundary of the region whose upper boundary is the information bottleneck curve of X with respect to S [AC20].The curve is swept over utility rates rather than Lagrange multipliers: it is convex, often with a narrow range of slopes, so a sweep over the multiplier would resolve only a few of its points.
- class PrivacyFunnel(dist, beta, rvs=None, crvs=None, bound=None)[source]
Bases:
BaseAuxVarOptimizerThe privacy funnel Lagrangian [MSFMedard14],
\[\min_{p(t | x, z)} I[S : T | Z] - \beta I[X : T | Z],\]over mappings T of X, so that S - XZ - T. Since
I[S : T | Z] <= I[X : T | Z], everybeta >= 1is minimized by releasingT = X, so the whole curve is traced bybetain [0, 1]. The objective is a difference of convex functions of the mapping, so it is non-convex [AC20].- construct_copy_initial()[source]
The identity mapping T = X, within each value of Z.
- Returns:
x – An optimization vector.
- Return type:
np.ndarray
- optimize(*args, **kwargs)[source]
Optimize, then keep the best of the result and the candidate mappings, since local search started at a seed can drift away from it.
- Parameters:
args – Passed to
BaseAuxVarOptimizer.optimize().kwargs – Passed to
BaseAuxVarOptimizer.optimize().
- Returns:
result – The result of the search.
- Return type:
OptimizeResult
- class PrivacyFunnelRate(dist, rate, rvs=None, crvs=None, bound=None)[source]
Bases:
PrivacyFunnelThe privacy funnel [MSFMedard14],
\[\mathrm{PF}(R) = \min_{p(t | x, z) : I[X : T | Z] \geq R} I[S : T | Z].\]The size of T is bounded by
|X| + 1; unlike the information bottleneck,|X|does not suffice in general [AC20].- optimize(*args, **kwargs)[source]
Optimize from the identity mapping, which is always feasible, a few times, then keep the best feasible candidate.
- Parameters:
args – Passed to
BaseAuxVarOptimizer.optimize().kwargs – Passed to
BaseAuxVarOptimizer.optimize().
- Returns:
result – The result of the search.
- Return type:
OptimizeResult
- class PrivacyFunnelResult(p_t_given_x: ndarray, leakage: float, utility: float, active: int, assignments: ndarray | None = None, merges: tuple[tuple[int, int], ...] = ())[source]
Bases:
objectThe result of a finite-alphabet privacy funnel optimization.
- p_t_given_x
The privacy mapping \(p(t | x)\).
- Type:
np.ndarray
- assignments
The hard cluster assignment for each \(x\), when available.
- Type:
np.ndarray
- class RDCurve(dist, rv=None, crvs=None, beta_min=0, beta_max=10, beta_num=101, alpha=1.0, distortion=('Hamming', <function hamming_distortion>, <class 'dit.rate_distortion.rate_distortion.RateDistortionHamming'>), method=None)[source]
Bases:
objectCompute a rate-distortion curve.
- find_max_beta()[source]
Find a beta value which maximizes the rate.
- Returns:
beta_max – The the smallest found beta value which achieves minimal distortion.
- Return type:
- class ShapeFunction(dist, rvs=None, crvs=None, alphas=None, num=11, niter=None, maxiter=1000, bound=None)[source]
Bases:
objectThe shape function of a tuple of random variables.
- alphas
The sampled directions, shape
(num_points, n).- Type:
np.ndarray
- values
The shape function at each direction.
- Type:
np.ndarray
- minima, maxima
The
S_minandS_maxenvelopes at each direction.- Type:
np.ndarray
- minimum(alpha)[source]
The
S_minenvelope, which depends only on the entropy profile.- Parameters:
alpha (array-like) – A direction, or an array of directions with n columns.
- Returns:
value – The lower bound at each direction.
- Return type:
np.ndarray
- maximum(alpha)[source]
The
S_maxenvelope, which depends only on the entropy profile.- Parameters:
alpha (array-like) – A direction, or an array of directions with n columns.
- Returns:
value – The upper bound at each direction.
- Return type:
np.ndarray
- evaluate(alpha, niter=None, maxiter=1000, rng=None)[source]
Evaluate the shape function in a single direction.
- admits_perfect_privacy(dist, rvs=None)[source]
Determine whether X can be released with non-zero utility and zero leakage about S.
This is the case if and only if the vectors p(S | x), over the support of X, are linearly dependent [CMMedard15]; in particular, whenever
|X| > |S|.- Parameters:
dist (Distribution) – The distribution of interest.
rvs (iterable of iterables, None) – The private variables S and the public variables X. If None, use
dist.rvs.
- Returns:
perfect – Whether perfect privacy is possible.
- Return type:
- asymmetric_private_interaction_information(dist, rvs=None, crvs=None, niter=None, maxiter=1000, bound=None)[source]
Compute the asymmetric private interaction information.
\[G_{PNI}(X \to Y) = \max_{U \perp X} I[X{:}Y|U] - I[X{:}Y]\]the maximal interaction information achievable by a probe independent of the first source [LEG18a]. Operationally, if Alice holds
Xand must generateYusing only public randomnessW, the least leakageI[Y:W]she can achieve isH[Y|X] - G_PNI(X -> Y).It vanishes exactly when the maximal interaction information does. This quantity is not symmetric; swap rvs for the other direction.
- Parameters:
dist (Distribution) – The distribution of interest.
rvs (list of lists, None) – The two sources, in the order
[X, Y]. If None, all variables of dist are used.crvs (list, None) – Variables to condition on.
niter (int, None) – Number of basin hops to perform during the optimization.
maxiter (int) – The number of iterations of the optimization subroutine to perform.
bound (int, None) – Bound the size of the probe variable.
- Returns:
G – The asymmetric private interaction information.
- Return type:
- excess_functional_information(pxy, max_functions=200000, reduce=True)[source]
The excess functional information [LEG18b]
\[\Psi(X \to Y) = \inf_{W \perp X} H[Y|W] - I[X:Y],\]computed exactly. Refining any \(W\) independent of \(X\) by a random function \(F: \mathcal{X} \to \mathcal{Y}\) independent of \(X\) only lowers \(H[Y|W]\), and \(H[Y | F = f] = H[f(X)]\), so the infimum is a linear program over distributions on functions with \(P(f(x) = y) = p(y|x)\).
Three exact reductions shrink that program first:
Common part. With \(g\) the Gács-Körner common part (the connected components of the support), a \(W\) independent of \(X\) is independent of \(g\) and of \(X\) given \(g\), and per-block auxiliaries combine into one, so \(\inf H[Y|W] = H[g] + \sum_k p(k) \inf H[Y|W, g = k]\).
X to its minimal sufficient statistic about Y. Merging values with identical \(p(y|x)\) leaves the infimum unchanged: an auxiliary for the merged variable lifts by resampling \(X\) given its class independently of \((Y, W)\).
Y to its minimal sufficient statistic about X. Merging values with proportional \(p(x|y)\) also leaves it unchanged: given its class \(Y\) is independent of \(X\), so \(W\) can carry an independent draw of \(Y\) for every class.
- Parameters:
- Returns:
psi (float, None) – The excess functional information.
inf_h (float, None) – \(\inf_{W \perp X} H[Y|W] = I[X:Y] + \Psi\), the height of the corner \((H[X], I + \Psi, I + \Psi)\) of the extension profile.
- extension_to_rates(extension, joint_entropy)[source]
Convert extension-profile coordinates back to a Gray-Wyner rate point.
Inverts
rates_to_extension().- Parameters:
extension (ExtensionPoint) – The point of the extension profile.
joint_entropy (float) – The joint entropy
H[X_{0:n}].
- Returns:
point – The corresponding Gray-Wyner rate point.
- Return type:
- greedy_privacy_funnel(p_sx, rate=0.0)[source]
Greedily merge released symbols for the privacy funnel [MSFMedard14].
Starting from \(T = X\), repeatedly merge the pair of symbols of \(T\) whose merger most reduces the leakage \(I(S : T)\) while keeping the utility \(I(X : T) \geq R\), until no merge is feasible. Each step is locally optimal; the result need not be globally optimal.
- Parameters:
p_sx (np.ndarray) – Joint distribution with axis 0 indexing the private \(S\) and axis 1 indexing the public \(X\).
rate (float) – The minimum utility \(R\), in bits. Must lie in \([0, H(X)]\).
- Returns:
result – The hard privacy mapping found.
- Return type:
- Raises:
ditException – If
rateis outside \([0, H(X)]\).
- hamming_matrix(k)[source]
Construct a
k x kHamming distortion matrix.- Parameters:
k (int) – The alphabet size.
- Returns:
d – The distortion matrix,
1 - I.- Return type:
np.ndarray
- information_bottleneck_rate(dist, rate, rvs=None, crvs=None, bound=None, niter=None, maxiter=None, rng=None)
Compute the information bottleneck at a fixed rate: the largest relevance
I[Y : T | Z]of a representation T of X with complexityI[X : T | Z] <= rate[TPB00].- Parameters:
dist (Distribution) – The distribution of interest.
rate (float) – The maximum complexity, in bits.
rvs (iter of iters, None) – The variables X and Y. If None, use
dist.rvs.crvs (iter, None) – The random variables to condition on.
bound (int, None) – The bound on the size of T. If None, use
|X||Z| + 1.niter (int, None) – The number of basin hops to perform.
maxiter (int, None) – The number of iterations of the optimization subroutine.
rng (np.random.Generator, int, None) – Source of randomness for the optimizer.
- Returns:
relevance – The maximal relevance.
- Return type:
- korner_graph_entropy(pxy, max_sets=5000, iters=5000, reduce=True)[source]
Körner’s graph entropy [Korner73] of the characteristic graph of \(X\) (two values are adjacent when some \(y\) is compatible with both),
\[H_K(X) = \min_{X \in U \in \Gamma} I[X:U],\]with \(\Gamma\) the maximal independent sets. In the extension profile it fixes the point \((x, H[Y|X] + x, x)\) with \(x = H[X] - H_K(X)\) on the edge \(U - X - Y\), \(H[X|Y, U] = 0\) [LEG18a].
The graph is first reduced by substitution [Korner73]: values with the same support set are adjacent twins, so each class collapses to one vertex at a cost of \(p(\text{class}) H[X|\text{class}]\); a disconnected graph contributes the weighted entropies of its components, and a join (disconnected complement) adds the entropy of the part masses. Only prime graphs enumerate maximal independent sets, on which the convex minimization is solved by Blahut-Arimoto style alternating minimization.
- Parameters:
- Returns:
h_k – The graph entropy.
- Return type:
float, None
- lossy_wyner_common_information(dist, distortion_bounds=None, distortions=None, rvs=None, crvs=None, niter=None, maxiter=1000, bound=None)[source]
The lossy Wyner common information
C(D_1, ..., D_n).This is the minimum common rate
R_0 = I(X_{1:n} : W)over auxiliary variablesWthat place the network on its minimum sum-rate face while meeting every distortion budget (Viswanatha, Akyol, & Rose 2014). ForD_i = 0(lossless) it coincides with the standard Wyner common information.- Parameters:
dist (Distribution) – The source distribution.
distortion_bounds (list, None) – Per-decoder distortion budgets
D_i. If None (or all zero), the lossless Wyner common information is returned.distortions (list, None) – Per-decoder distortion matrices (None entries are lossless).
rvs (list of lists, None) – The source groups. If None, each variable is its own source.
crvs (list, None) – Variables to condition on.
niter (int, None) – Number of basin hops.
maxiter (int) – Inner optimizer iterations.
bound (int, None) – Optional cap on the cardinality of
W.
- Returns:
C – The lossy Wyner common information.
- Return type:
- maximal_interaction_information(dist, rvs=None, crvs=None, niter=None, maxiter=1000, bound=None)[source]
Compute the maximal interaction information.
\[G_{NNI}(X : Y) = \max_U I[X{:}Y|U] - I[X{:}Y]\]the largest amount by which a probe can increase the dependence between
XandY[LEG18a]. It vanishes exactly when the support graph contains no path of length three, equivalently whenp(x|y) = 1orp(y|x) = 1at every outcome of positive probability, and is bounded above bymin{H[X|Y], H[Y|X]}.- Parameters:
dist (Distribution) – The distribution of interest.
rvs (list of lists, None) – The two sources. If None, all variables of dist are used.
crvs (list, None) – Variables to condition on.
niter (int, None) – Number of basin hops to perform during the optimization.
maxiter (int) – The number of iterations of the optimization subroutine to perform.
bound (int, None) – Bound the size of the probe variable.
- Returns:
G – The maximal interaction information.
- Return type:
- mutual_information_to_rates(info, marginal_entropies)[source]
Convert mutual information coordinates back to a Gray-Wyner rate point.
Inverts
rates_to_mutual_information().- Parameters:
info (MutualInformationPoint) – The point of the mutual information region.
marginal_entropies (iterable of float) – The marginal entropies
H[X_i].
- Returns:
point – The corresponding Gray-Wyner rate point.
- Return type:
- perfect_privacy_utility(dist, rvs=None, return_mechanism=False, max_candidates=100000)[source]
Compute the maximal utility at perfect privacy,
\[g_0 = \max_{p(t | x) : I(S : T) = 0} I(X : T),\]exactly, by enumerating the vertices of the perfect privacy polytope and solving a linear program [RGunduz21].
- Parameters:
dist (Distribution) – The distribution of interest.
rvs (iterable of iterables, None) – The private variables S and the public variables X. If None, use
dist.rvs.return_mechanism (bool) – If True, also return an optimal mapping p(t | x).
max_candidates (int) – The maximum number of column bases to enumerate.
- Returns:
g0 (float) – The maximal utility, in bits, of a release leaking nothing about S.
p_t_given_x (np.ndarray) – An optimal mapping of shape
(|X|, |T|), ifreturn_mechanism.
- Raises:
ditException – If the polytope has too many candidate bases.
- privacy_funnel(dist, beta, rvs=None, crvs=None, bound=None)
Compute a point on the privacy funnel by minimizing
I[S : T | Z] - beta I[X : T | Z][MSFMedard14].- Parameters:
dist (Distribution) – The distribution of interest.
beta (float) – The non-negative price of utility.
rvs (iterable of iterables, None) – The private variables S and the public variables X. If None, use
dist.rvs.crvs (iterable, None) – The random variables to condition on.
bound (int, None) – The bound on the size of T. If None, use
|X|.
- Returns:
leakage (float) – I[S : T | Z] at the optimum.
utility (float) – I[X : T | Z] at the optimum.
- privacy_funnel_rate(dist, rate, rvs=None, crvs=None, bound=None)
Compute the privacy funnel, the least leakage
I[S : T | Z]of a release T of X with utilityI[X : T | Z] >= rate[MSFMedard14].- Parameters:
dist (Distribution) – The distribution of interest.
rate (float) – The minimum utility, in bits.
rvs (iterable of iterables, None) – The private variables S and the public variables X. If None, use
dist.rvs.crvs (iterable, None) – The random variables to condition on.
bound (int, None) – The bound on the size of T. If None, use
|X| + 1.
- Returns:
pf – The minimal leakage.
- Return type:
- rates_to_extension(point, joint_entropy)[source]
Convert a Gray-Wyner rate point to extension-profile coordinates.
The private rates are the conditional entropies
H[X_i | W], so this map only computes the residual coordinate.- Parameters:
point (GrayWynerPoint) – The rate point
(R_0, (R_1, ..., R_n)).joint_entropy (float) – The joint entropy
H[X_{0:n}].
- Returns:
extension – The corresponding point of the extension profile.
- Return type:
- rates_to_mutual_information(point, marginal_entropies)[source]
Convert a Gray-Wyner rate point to mutual information coordinates.
- Parameters:
point (GrayWynerPoint) – The rate point
(R_0, (R_1, ..., R_n)).marginal_entropies (iterable of float) – The marginal entropies
H[X_i].
- Returns:
info – The corresponding point of the mutual information region.
- Return type:
- rates_to_tension(point, marginal_entropies, joint_entropy)[source]
Convert a Gray-Wyner rate point to tension coordinates.
- Parameters:
point (GrayWynerPoint) – The rate point
(R_0, (R_1, ..., R_n)).marginal_entropies (iterable of float) – The marginal entropies
H[X_i].joint_entropy (float) – The joint entropy
H[X_{0:n}].
- Returns:
tension – The corresponding point of the region of tension.
- Return type:
- symmetric_private_interaction_information(dist, rvs=None, crvs=None, niter=None, maxiter=1000, bound=None)[source]
Compute the symmetric private interaction information.
\[G_{PPI}(X : Y) = \max_{U \perp X,\, U \perp Y} I[X{:}Y|U] - I[X{:}Y] = \max_{U \perp X,\, U \perp Y} I[XY{:}U]\]the most that can be disclosed about the pair while telling an eavesdropper holding either source alone nothing [LEG18a]. It vanishes exactly when the support graph is acyclic.
- Parameters:
dist (Distribution) – The distribution of interest.
rvs (list of lists, None) – The two sources. If None, all variables of dist are used.
crvs (list, None) – Variables to condition on.
niter (int, None) – Number of basin hops to perform during the optimization.
maxiter (int) – The number of iterations of the optimization subroutine to perform.
bound (int, None) – Bound the size of the probe variable.
- Returns:
G – The symmetric private interaction information.
- Return type:
- tension_to_rates(tension, marginal_entropies, joint_entropy)[source]
Convert tension coordinates back to a Gray-Wyner rate point.
Inverts
rates_to_tension(). Summing the per-source tensions and subtracting the residual eliminates the private rates and leaves(n - 1) R_0, which is why at least two sources are required.- Parameters:
tension (TensionPoint) – The point of the region of tension.
marginal_entropies (iterable of float) – The marginal entropies
H[X_i].joint_entropy (float) – The joint entropy
H[X_{0:n}].
- Returns:
point – The corresponding Gray-Wyner rate point.
- Return type: