dit 1.5__tar.gz → 2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (524) hide show
  1. dit-2.2/.gitignore +63 -0
  2. dit-2.2/PKG-INFO +494 -0
  3. dit-1.5/dit.egg-info/PKG-INFO → dit-2.2/README.rst +108 -111
  4. dit-2.2/dit/__init__.py +41 -0
  5. dit-2.2/dit/abc.py +116 -0
  6. {dit-1.5 → dit-2.2}/dit/abstractdist.py +22 -26
  7. {dit-1.5 → dit-2.2}/dit/algorithms/__init__.py +23 -3
  8. dit-2.2/dit/algorithms/admui.py +202 -0
  9. dit-2.2/dit/algorithms/broja_cone.py +368 -0
  10. dit-2.2/dit/algorithms/broja_method.py +178 -0
  11. dit-2.2/dit/algorithms/broja_util.py +11 -0
  12. dit-2.2/dit/algorithms/caekl_psp.py +215 -0
  13. dit-2.2/dit/algorithms/channelcapacity.py +145 -0
  14. dit-2.2/dit/algorithms/convex_maximization.py +89 -0
  15. {dit-1.5 → dit-2.2}/dit/algorithms/distribution_optimizers.py +311 -84
  16. {dit-1.5 → dit-2.2}/dit/algorithms/frankwolfe.py +23 -34
  17. dit-2.2/dit/algorithms/ipf.py +111 -0
  18. {dit-1.5 → dit-2.2}/dit/algorithms/lattice.py +63 -114
  19. {dit-1.5 → dit-2.2}/dit/algorithms/maxentropy.py +125 -85
  20. {dit-1.5 → dit-2.2}/dit/algorithms/maxentropyfw.py +36 -75
  21. {dit-1.5 → dit-2.2}/dit/algorithms/minimal_sufficient_statistic.py +26 -55
  22. dit-2.2/dit/algorithms/optimization.py +2280 -0
  23. dit-2.2/dit/algorithms/optimization_jax.py +2316 -0
  24. dit-2.2/dit/algorithms/optimization_pytensor.py +1979 -0
  25. dit-2.2/dit/algorithms/optimization_torch.py +2188 -0
  26. {dit-1.5 → dit-2.2}/dit/algorithms/optutil.py +36 -33
  27. {dit-1.5 → dit-2.2}/dit/algorithms/pid_broja.py +107 -132
  28. {dit-1.5 → dit-2.2}/dit/algorithms/prune_expand.py +51 -28
  29. dit-2.2/dit/algorithms/stats.py +488 -0
  30. dit-2.2/dit/algorithms/submodular.py +165 -0
  31. {dit-1.5 → dit-2.2}/dit/bgm.py +20 -25
  32. dit-2.2/dit/cdisthelpers.py +77 -0
  33. dit-2.2/dit/channelorder/__init__.py +27 -0
  34. dit-2.2/dit/channelorder/_utils.py +190 -0
  35. dit-2.2/dit/channelorder/deficiency.py +473 -0
  36. dit-2.2/dit/channelorder/orderings.py +569 -0
  37. dit-2.2/dit/coding/__init__.py +90 -0
  38. dit-2.2/dit/coding/_channel.py +119 -0
  39. dit-2.2/dit/coding/_gf2.py +128 -0
  40. dit-2.2/dit/coding/_util.py +102 -0
  41. dit-2.2/dit/coding/base.py +248 -0
  42. dit-2.2/dit/coding/block_codes.py +147 -0
  43. dit-2.2/dit/coding/codes.py +391 -0
  44. dit-2.2/dit/coding/convolutional.py +166 -0
  45. dit-2.2/dit/coding/ldpc.py +154 -0
  46. dit-2.2/dit/coding/linear.py +197 -0
  47. dit-2.2/dit/coding/polar.py +134 -0
  48. dit-2.2/dit/coding/source_polar.py +508 -0
  49. dit-2.2/dit/coding/symbol_code.py +258 -0
  50. dit-2.2/dit/coding/tunstall.py +181 -0
  51. dit-2.2/dit/coding/universal.py +130 -0
  52. {dit-1.5 → dit-2.2}/dit/distconst.py +319 -124
  53. dit-2.2/dit/distribution.py +2626 -0
  54. {dit-1.5 → dit-2.2}/dit/divergences/__init__.py +15 -19
  55. {dit-1.5 → dit-2.2}/dit/divergences/_kl_nonmerge.py +14 -14
  56. {dit-1.5 → dit-2.2}/dit/divergences/copy_mutual_information.py +9 -16
  57. dit-2.2/dit/divergences/coupling_metrics.py +274 -0
  58. {dit-1.5 → dit-2.2}/dit/divergences/cross_entropy.py +29 -26
  59. dit-2.2/dit/divergences/earth_movers_distance.py +233 -0
  60. {dit-1.5 → dit-2.2}/dit/divergences/generalized_divergences.py +31 -81
  61. dit-2.2/dit/divergences/hypercontractivity_coefficient.py +236 -0
  62. {dit-1.5 → dit-2.2}/dit/divergences/jensen_shannon_divergence.py +20 -18
  63. {dit-1.5 → dit-2.2}/dit/divergences/kullback_leibler_divergence.py +6 -14
  64. {dit-1.5 → dit-2.2}/dit/divergences/maximum_correlation.py +10 -23
  65. {dit-1.5 → dit-2.2}/dit/divergences/pmf.py +25 -20
  66. {dit-1.5 → dit-2.2}/dit/divergences/variational_distance.py +11 -11
  67. dit-2.2/dit/example_channels/__init__.py +36 -0
  68. dit-2.2/dit/example_channels/_util.py +52 -0
  69. dit-2.2/dit/example_channels/binary.py +142 -0
  70. dit-2.2/dit/example_channels/qary.py +99 -0
  71. dit-2.2/dit/example_channels/trivial.py +57 -0
  72. {dit-1.5 → dit-2.2}/dit/example_dists/__init__.py +3 -2
  73. {dit-1.5 → dit-2.2}/dit/example_dists/circuits.py +29 -35
  74. {dit-1.5 → dit-2.2}/dit/example_dists/dependencies.py +45 -45
  75. {dit-1.5 → dit-2.2}/dit/example_dists/dice.py +44 -13
  76. dit-2.2/dit/example_dists/empirical/__init__.py +16 -0
  77. dit-2.2/dit/example_dists/empirical/_music.py +127 -0
  78. dit-2.2/dit/example_dists/empirical/bach.py +77 -0
  79. dit-2.2/dit/example_dists/empirical/blood_types.py +203 -0
  80. dit-2.2/dit/example_dists/empirical/car.py +95 -0
  81. dit-2.2/dit/example_dists/empirical/congress.py +109 -0
  82. dit-2.2/dit/example_dists/empirical/corelli.py +132 -0
  83. dit-2.2/dit/example_dists/empirical/penguins.py +77 -0
  84. dit-2.2/dit/example_dists/empirical/student.py +94 -0
  85. dit-2.2/dit/example_dists/empirical/titanic.py +85 -0
  86. {dit-1.5 → dit-2.2}/dit/example_dists/giant_bit.py +5 -6
  87. dit-2.2/dit/example_dists/intrinsic.py +30 -0
  88. dit-2.2/dit/example_dists/mdbsi.py +17 -0
  89. dit-2.2/dit/example_dists/miscellaneous.py +11 -0
  90. {dit-1.5 → dit-2.2}/dit/example_dists/n_mod_m.py +6 -9
  91. {dit-1.5 → dit-2.2}/dit/example_dists/nonsignalling_boxes.py +2 -5
  92. {dit-1.5 → dit-2.2}/dit/example_dists/numeric.py +87 -20
  93. {dit-1.5 → dit-2.2}/dit/exceptions.py +26 -30
  94. {dit-1.5 → dit-2.2}/dit/helpers.py +76 -183
  95. {dit-1.5 → dit-2.2}/dit/inference/__init__.py +2 -1
  96. {dit-1.5 → dit-2.2}/dit/inference/binning.py +6 -10
  97. dit-2.2/dit/inference/counts.c +180 -0
  98. {dit-1.5 → dit-2.2}/dit/inference/counts.py +53 -29
  99. {dit-1.5 → dit-2.2}/dit/inference/estimators.py +4 -5
  100. {dit-1.5 → dit-2.2}/dit/inference/knn_estimators.py +23 -14
  101. dit-2.2/dit/inference/pycounts.pyx +506 -0
  102. {dit-1.5 → dit-2.2}/dit/inference/segmentaxis.py +14 -22
  103. {dit-1.5 → dit-2.2}/dit/inference/time_series.py +12 -14
  104. dit-2.2/dit/math/__init__.py +20 -0
  105. dit-2.2/dit/math/_close.pyx +35 -0
  106. dit-2.2/dit/math/_samplediscrete.pyx +95 -0
  107. {dit-1.5 → dit-2.2}/dit/math/aitchison.py +27 -44
  108. {dit-1.5 → dit-2.2}/dit/math/combinatorics.py +5 -9
  109. {dit-1.5 → dit-2.2}/dit/math/equal.py +19 -21
  110. {dit-1.5 → dit-2.2}/dit/math/fraction.py +1 -4
  111. {dit-1.5 → dit-2.2}/dit/math/misc.py +14 -16
  112. {dit-1.5 → dit-2.2}/dit/math/ops.py +39 -48
  113. {dit-1.5 → dit-2.2}/dit/math/pmfops.py +24 -28
  114. {dit-1.5 → dit-2.2}/dit/math/sampling.py +27 -38
  115. {dit-1.5 → dit-2.2}/dit/math/sigmaalgebra.py +12 -19
  116. {dit-1.5 → dit-2.2}/dit/multivariate/__init__.py +8 -0
  117. dit-2.2/dit/multivariate/_backend.py +210 -0
  118. {dit-1.5 → dit-2.2}/dit/multivariate/caekl_mutual_information.py +21 -20
  119. {dit-1.5 → dit-2.2}/dit/multivariate/cohesion.py +5 -15
  120. {dit-1.5 → dit-2.2}/dit/multivariate/coinformation.py +14 -24
  121. {dit-1.5 → dit-2.2}/dit/multivariate/common_informations/__init__.py +7 -0
  122. dit-2.2/dit/multivariate/common_informations/_functional_partition.py +223 -0
  123. dit-2.2/dit/multivariate/common_informations/base_markov_optimizer.py +379 -0
  124. dit-2.2/dit/multivariate/common_informations/beta_common_information.py +344 -0
  125. {dit-1.5 → dit-2.2}/dit/multivariate/common_informations/exact_common_information.py +15 -7
  126. dit-2.2/dit/multivariate/common_informations/functional_common_information.py +572 -0
  127. {dit-1.5 → dit-2.2}/dit/multivariate/common_informations/gk_common_information.py +15 -23
  128. dit-2.2/dit/multivariate/common_informations/kamath_common_information.py +134 -0
  129. dit-2.2/dit/multivariate/common_informations/maxent_function.py +323 -0
  130. {dit-1.5 → dit-2.2}/dit/multivariate/common_informations/mss_common_information.py +7 -17
  131. dit-2.2/dit/multivariate/common_informations/stochastic_gk_common_information.py +176 -0
  132. dit-2.2/dit/multivariate/common_informations/symbolic_ansatz.py +103 -0
  133. dit-2.2/dit/multivariate/common_informations/symbolic_markov.py +196 -0
  134. dit-2.2/dit/multivariate/common_informations/symbolic_solve.py +301 -0
  135. {dit-1.5 → dit-2.2}/dit/multivariate/common_informations/wyner_common_information.py +15 -6
  136. dit-2.2/dit/multivariate/cross_mutual_information.py +205 -0
  137. dit-2.2/dit/multivariate/delta_gamma.py +120 -0
  138. {dit-1.5 → dit-2.2}/dit/multivariate/deweese.py +38 -44
  139. {dit-1.5 → dit-2.2}/dit/multivariate/dual_total_correlation.py +16 -38
  140. {dit-1.5 → dit-2.2}/dit/multivariate/entropy.py +8 -17
  141. {dit-1.5 → dit-2.2}/dit/multivariate/interaction_information.py +5 -15
  142. dit-2.2/dit/multivariate/logarithmic_decomposition.py +468 -0
  143. dit-2.2/dit/multivariate/mmi_psp.py +247 -0
  144. {dit-1.5 → dit-2.2}/dit/multivariate/necessary_conditional_entropy.py +6 -16
  145. {dit-1.5 → dit-2.2}/dit/multivariate/o_information.py +5 -15
  146. dit-2.2/dit/multivariate/quax_synergy.py +250 -0
  147. dit-2.2/dit/multivariate/s_information.py +48 -0
  148. dit-2.2/dit/multivariate/secret_key_agreement/__init__.py +50 -0
  149. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/base_skar_optimizers.py +437 -263
  150. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/interactive_intrinsic_mutual_informations.py +71 -34
  151. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/intrinsic_mutual_informations.py +22 -15
  152. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/minimal_intrinsic_mutual_informations.py +44 -16
  153. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/no_communication.py +4 -14
  154. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/one_way_skar.py +24 -20
  155. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/reduced_intrinsic_mutual_informations.py +19 -19
  156. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/secrecy_capacity.py +12 -16
  157. dit-2.2/dit/multivariate/secret_key_agreement/skar_lower_bounds.py +86 -0
  158. dit-2.2/dit/multivariate/secret_key_agreement/trivial_bounds.py +132 -0
  159. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/two_part_intrinsic_mutual_informations.py +14 -16
  160. {dit-1.5 → dit-2.2}/dit/multivariate/secret_key_agreement/two_way_skar.py +39 -42
  161. dit-2.2/dit/multivariate/synergistic_disclosure.py +218 -0
  162. {dit-1.5 → dit-2.2}/dit/multivariate/total_correlation.py +5 -15
  163. dit-2.2/dit/multivariate/transmission.py +56 -0
  164. {dit-1.5 → dit-2.2}/dit/multivariate/tse_complexity.py +6 -16
  165. dit-2.2/dit/multivariate/union_information.py +205 -0
  166. {dit-1.5 → dit-2.2}/dit/other/__init__.py +8 -0
  167. {dit-1.5 → dit-2.2}/dit/other/cumulative_residual_entropy.py +29 -40
  168. dit-2.2/dit/other/disequilibrium.py +75 -0
  169. {dit-1.5 → dit-2.2}/dit/other/extropy.py +18 -26
  170. {dit-1.5 → dit-2.2}/dit/other/lautum_information.py +5 -15
  171. dit-2.2/dit/other/negentropy.py +54 -0
  172. dit-2.2/dit/other/perplexity.py +38 -0
  173. dit-2.2/dit/other/renyi_entropy.py +61 -0
  174. dit-2.2/dit/other/sibson_mutual_information.py +309 -0
  175. {dit-1.5 → dit-2.2}/dit/other/tsallis_entropy.py +6 -19
  176. {dit-1.5 → dit-2.2}/dit/params.py +33 -40
  177. {dit-1.5 → dit-2.2}/dit/pid/__init__.py +2 -0
  178. dit-2.2/dit/pid/distributions/__init__.py +55 -0
  179. dit-2.2/dit/pid/distributions/bivariate.py +125 -0
  180. dit-2.2/dit/pid/distributions/trivariate.py +85 -0
  181. {dit-1.5 → dit-2.2}/dit/pid/hcs.py +8 -36
  182. dit-2.2/dit/pid/helpers.py +112 -0
  183. dit-2.2/dit/pid/hmos.py +224 -0
  184. {dit-1.5 → dit-2.2}/dit/pid/measures/__init__.py +18 -1
  185. {dit-1.5 → dit-2.2}/dit/pid/measures/ibroja.py +51 -25
  186. {dit-1.5 → dit-2.2}/dit/pid/measures/iccs.py +19 -12
  187. {dit-1.5 → dit-2.2}/dit/pid/measures/ict.py +3 -6
  188. dit-2.2/dit/pid/measures/ideg.py +187 -0
  189. dit-2.2/dit/pid/measures/idelta.py +107 -0
  190. dit-2.2/dit/pid/measures/ideltalambda.py +257 -0
  191. {dit-1.5 → dit-2.2}/dit/pid/measures/idep.py +17 -18
  192. dit-2.2/dit/pid/measures/ido.py +132 -0
  193. {dit-1.5 → dit-2.2}/dit/pid/measures/igh.py +51 -28
  194. dit-2.2/dit/pid/measures/iig.py +130 -0
  195. dit-2.2/dit/pid/measures/iipid.py +148 -0
  196. dit-2.2/dit/pid/measures/imc.py +301 -0
  197. {dit-1.5 → dit-2.2}/dit/pid/measures/imes.py +2 -6
  198. {dit-1.5 → dit-2.2}/dit/pid/measures/imin.py +21 -5
  199. {dit-1.5 → dit-2.2}/dit/pid/measures/immi.py +8 -6
  200. dit-2.2/dit/pid/measures/ipm.py +97 -0
  201. {dit-1.5 → dit-2.2}/dit/pid/measures/iprec.py +51 -39
  202. {dit-1.5 → dit-2.2}/dit/pid/measures/iproj.py +21 -21
  203. {dit-1.5 → dit-2.2}/dit/pid/measures/irav.py +7 -11
  204. dit-2.2/dit/pid/measures/irdr.py +166 -0
  205. {dit-1.5 → dit-2.2}/dit/pid/measures/irr.py +2 -6
  206. {dit-1.5 → dit-2.2}/dit/pid/measures/iskar.py +13 -9
  207. dit-2.2/dit/pid/measures/isx.py +105 -0
  208. {dit-1.5 → dit-2.2}/dit/pid/measures/iwedge.py +5 -8
  209. dit-2.2/dit/pid/ped.py +56 -0
  210. {dit-1.5 → dit-2.2}/dit/pid/pid.py +380 -84
  211. dit-2.2/dit/pid/syndisc.py +585 -0
  212. {dit-1.5 → dit-2.2}/dit/profiles/__init__.py +1 -0
  213. {dit-1.5 → dit-2.2}/dit/profiles/base_profile.py +31 -13
  214. {dit-1.5 → dit-2.2}/dit/profiles/complexity_profile.py +4 -8
  215. {dit-1.5 → dit-2.2}/dit/profiles/entropy_triangle.py +17 -10
  216. {dit-1.5 → dit-2.2}/dit/profiles/information_partitions.py +73 -51
  217. {dit-1.5 → dit-2.2}/dit/profiles/marginal_utility_of_information.py +11 -18
  218. {dit-1.5 → dit-2.2}/dit/profiles/schneidman.py +9 -13
  219. dit-2.2/dit/profiles/shapley_info_decomposition.py +210 -0
  220. dit-2.2/dit/rate_distortion/__init__.py +13 -0
  221. {dit-1.5 → dit-2.2}/dit/rate_distortion/blahut_arimoto.py +35 -24
  222. dit-2.2/dit/rate_distortion/bottleneck_algorithms.py +501 -0
  223. {dit-1.5 → dit-2.2}/dit/rate_distortion/curves.py +167 -57
  224. dit-2.2/dit/rate_distortion/distortions.py +50 -0
  225. dit-2.2/dit/rate_distortion/gray_wyner/__init__.py +31 -0
  226. dit-2.2/dit/rate_distortion/gray_wyner/curve.py +148 -0
  227. dit-2.2/dit/rate_distortion/gray_wyner/network.py +248 -0
  228. dit-2.2/dit/rate_distortion/gray_wyner/optimizer.py +298 -0
  229. dit-2.2/dit/rate_distortion/gray_wyner/plotting.py +49 -0
  230. {dit-1.5 → dit-2.2}/dit/rate_distortion/information_bottleneck.py +126 -47
  231. {dit-1.5 → dit-2.2}/dit/rate_distortion/plotting.py +21 -22
  232. {dit-1.5 → dit-2.2}/dit/rate_distortion/rate_distortion.py +109 -40
  233. {dit-1.5 → dit-2.2}/dit/samplespace.py +30 -44
  234. dit-2.2/dit/shannon/__init__.py +5 -0
  235. {dit-1.5 → dit-2.2}/dit/shannon/shannon.py +35 -44
  236. dit-2.2/dit/symbolic/__init__.py +33 -0
  237. dit-2.2/dit/symbolic/distributions.py +165 -0
  238. {dit-1.5 → dit-2.2}/dit/utils/__init__.py +3 -2
  239. {dit-1.5 → dit-2.2}/dit/utils/bindargs.py +1 -4
  240. {dit-1.5 → dit-2.2}/dit/utils/context.py +5 -9
  241. {dit-1.5 → dit-2.2}/dit/utils/latexarray.py +44 -58
  242. dit-2.2/dit/utils/logger.py +45 -0
  243. {dit-1.5 → dit-2.2}/dit/utils/misc.py +42 -47
  244. {dit-1.5 → dit-2.2}/dit/utils/optimization.py +135 -33
  245. {dit-1.5 → dit-2.2}/dit/utils/table.py +8 -12
  246. {dit-1.5 → dit-2.2}/dit/utils/testing.py +123 -9
  247. {dit-1.5 → dit-2.2}/dit/utils/units.py +8 -9
  248. {dit-1.5 → dit-2.2}/dit/validate.py +16 -17
  249. dit-2.2/dit/visualization/__init__.py +10 -0
  250. dit-2.2/dit/visualization/upset.py +313 -0
  251. dit-2.2/pyproject.toml +324 -0
  252. dit-2.2/tests/__init__.py +3 -0
  253. dit-2.2/tests/_backends.py +48 -0
  254. dit-2.2/tests/algorithms/__init__.py +3 -0
  255. dit-2.2/tests/algorithms/test_admui.py +80 -0
  256. dit-2.2/tests/algorithms/test_broja_cone.py +33 -0
  257. dit-2.2/tests/algorithms/test_caekl_psp_optimizer.py +36 -0
  258. dit-2.2/tests/algorithms/test_channelcapacity.py +201 -0
  259. dit-2.2/tests/algorithms/test_degrees_of_freedom.py +63 -0
  260. dit-2.2/tests/algorithms/test_ipf.py +91 -0
  261. dit-2.2/tests/algorithms/test_lattice.py +99 -0
  262. dit-2.2/tests/algorithms/test_marginal_constraints.py +38 -0
  263. dit-2.2/tests/algorithms/test_maxentropy_fast.py +134 -0
  264. dit-2.2/tests/algorithms/test_minimal_sufficient_statistic.py +56 -0
  265. dit-2.2/tests/algorithms/test_optimizers.py +300 -0
  266. dit-2.2/tests/algorithms/test_parallel_sweep.py +105 -0
  267. dit-2.2/tests/algorithms/test_prune_expand.py +92 -0
  268. dit-2.2/tests/algorithms/test_stats.py +286 -0
  269. dit-2.2/tests/algorithms/test_submodular.py +60 -0
  270. dit-2.2/tests/channelorder/__init__.py +0 -0
  271. dit-2.2/tests/channelorder/test_deficiency.py +191 -0
  272. dit-2.2/tests/channelorder/test_orderings.py +232 -0
  273. dit-2.2/tests/channelorder/test_properties.py +202 -0
  274. dit-2.2/tests/channelorder/test_utils.py +105 -0
  275. dit-2.2/tests/coding/__init__.py +0 -0
  276. dit-2.2/tests/coding/test_base.py +45 -0
  277. dit-2.2/tests/coding/test_channel.py +60 -0
  278. dit-2.2/tests/coding/test_channel_codes.py +146 -0
  279. dit-2.2/tests/coding/test_edge_cases.py +157 -0
  280. dit-2.2/tests/coding/test_gf2.py +49 -0
  281. dit-2.2/tests/coding/test_golomb.py +76 -0
  282. dit-2.2/tests/coding/test_linear.py +115 -0
  283. dit-2.2/tests/coding/test_source_edges.py +158 -0
  284. dit-2.2/tests/coding/test_source_polar.py +282 -0
  285. dit-2.2/tests/coding/test_symbol_codes.py +178 -0
  286. dit-2.2/tests/coding/test_tunstall.py +63 -0
  287. dit-2.2/tests/coding/test_universal.py +74 -0
  288. dit-2.2/tests/conftest.py +8 -0
  289. dit-2.2/tests/divergences/__init__.py +3 -0
  290. dit-2.2/tests/divergences/test_copy_mutual_information.py +24 -0
  291. dit-2.2/tests/divergences/test_coupling_metrics.py +94 -0
  292. dit-2.2/tests/divergences/test_cross_entropy.py +70 -0
  293. dit-2.2/tests/divergences/test_emd.py +115 -0
  294. dit-2.2/tests/divergences/test_generalized_divergences.py +267 -0
  295. dit-2.2/tests/divergences/test_hypercontractivity_coefficient.py +62 -0
  296. dit-2.2/tests/divergences/test_jensen_shannon_divergence.py +133 -0
  297. dit-2.2/tests/divergences/test_kullback_leibler_divergence.py +69 -0
  298. dit-2.2/tests/divergences/test_maximum_correlation.py +46 -0
  299. dit-2.2/tests/divergences/test_nonmerge.py +62 -0
  300. dit-2.2/tests/divergences/test_variational_distance.py +39 -0
  301. dit-2.2/tests/example_channels/__init__.py +0 -0
  302. dit-2.2/tests/example_channels/test_binary.py +100 -0
  303. dit-2.2/tests/example_channels/test_qary.py +91 -0
  304. dit-2.2/tests/example_channels/test_trivial.py +51 -0
  305. dit-2.2/tests/example_channels/test_util.py +63 -0
  306. dit-2.2/tests/example_dists/__init__.py +3 -0
  307. dit-2.2/tests/example_dists/empirical/__init__.py +0 -0
  308. dit-2.2/tests/example_dists/empirical/test_bach.py +44 -0
  309. dit-2.2/tests/example_dists/empirical/test_blood_types.py +67 -0
  310. dit-2.2/tests/example_dists/empirical/test_car.py +69 -0
  311. dit-2.2/tests/example_dists/empirical/test_congress.py +72 -0
  312. dit-2.2/tests/example_dists/empirical/test_corelli.py +47 -0
  313. dit-2.2/tests/example_dists/empirical/test_penguins.py +60 -0
  314. dit-2.2/tests/example_dists/empirical/test_student.py +60 -0
  315. dit-2.2/tests/example_dists/empirical/test_titanic.py +59 -0
  316. dit-2.2/tests/example_dists/test_circuits.py +129 -0
  317. dit-2.2/tests/example_dists/test_dependencies.py +57 -0
  318. dit-2.2/tests/example_dists/test_dice.py +28 -0
  319. dit-2.2/tests/example_dists/test_giant_bit.py +30 -0
  320. dit-2.2/tests/example_dists/test_mdbsi.py +80 -0
  321. dit-2.2/tests/example_dists/test_miscellaneous.py +24 -0
  322. dit-2.2/tests/example_dists/test_n_mod_m.py +47 -0
  323. dit-2.2/tests/example_dists/test_numeric.py +176 -0
  324. dit-2.2/tests/example_dists/test_pr_box.py +38 -0
  325. dit-2.2/tests/inference/__init__.py +3 -0
  326. dit-2.2/tests/inference/test_binning.py +35 -0
  327. dit-2.2/tests/inference/test_counts.py +46 -0
  328. dit-2.2/tests/inference/test_estimators.py +43 -0
  329. dit-2.2/tests/inference/test_knn_estimators.py +99 -0
  330. dit-2.2/tests/inference/test_segmentaxis.py +84 -0
  331. dit-2.2/tests/inference/test_timeseries.py +96 -0
  332. dit-2.2/tests/math/__init__.py +3 -0
  333. dit-2.2/tests/math/test_aitchison.py +416 -0
  334. dit-2.2/tests/math/test_combinatorics.py +57 -0
  335. dit-2.2/tests/math/test_equal.py +89 -0
  336. dit-2.2/tests/math/test_fraction.py +43 -0
  337. dit-2.2/tests/math/test_misc.py +106 -0
  338. dit-2.2/tests/math/test_ops.py +174 -0
  339. dit-2.2/tests/math/test_pmfops.py +168 -0
  340. dit-2.2/tests/math/test_sampling.py +241 -0
  341. dit-2.2/tests/math/test_sigmaalgebra.py +148 -0
  342. dit-2.2/tests/multivariate/__init__.py +3 -0
  343. dit-2.2/tests/multivariate/common_informations/__init__.py +3 -0
  344. dit-2.2/tests/multivariate/common_informations/test_backend_switching.py +253 -0
  345. dit-2.2/tests/multivariate/common_informations/test_beta_common_information.py +303 -0
  346. dit-2.2/tests/multivariate/common_informations/test_common_informations.py +83 -0
  347. dit-2.2/tests/multivariate/common_informations/test_exact_common_information.py +63 -0
  348. dit-2.2/tests/multivariate/common_informations/test_functional_common_information.py +386 -0
  349. dit-2.2/tests/multivariate/common_informations/test_gk_common_information.py +68 -0
  350. dit-2.2/tests/multivariate/common_informations/test_kamath_common_information.py +129 -0
  351. dit-2.2/tests/multivariate/common_informations/test_maxent_function.py +191 -0
  352. dit-2.2/tests/multivariate/common_informations/test_mss_common_information.py +59 -0
  353. dit-2.2/tests/multivariate/common_informations/test_stochastic_gk_common_information.py +171 -0
  354. dit-2.2/tests/multivariate/common_informations/test_wyner_common_information.py +77 -0
  355. dit-2.2/tests/multivariate/secret_key_agreement/__init__.py +3 -0
  356. dit-2.2/tests/multivariate/secret_key_agreement/test_interactive_intrinsic_mutual_information.py +18 -0
  357. dit-2.2/tests/multivariate/secret_key_agreement/test_intrinsic_mutual_information.py +227 -0
  358. dit-2.2/tests/multivariate/secret_key_agreement/test_lower_intrinsic_mutual_information.py +17 -0
  359. dit-2.2/tests/multivariate/secret_key_agreement/test_minimal_intrinsic_mutual_information.py +68 -0
  360. dit-2.2/tests/multivariate/secret_key_agreement/test_necessary_intrinsic_mutual_information.py +20 -0
  361. dit-2.2/tests/multivariate/secret_key_agreement/test_reduced_intrinsic_mutual_information.py +118 -0
  362. dit-2.2/tests/multivariate/secret_key_agreement/test_secrecy_capacity.py +31 -0
  363. dit-2.2/tests/multivariate/secret_key_agreement/test_skars.py +45 -0
  364. dit-2.2/tests/multivariate/secret_key_agreement/test_trivial_bounds.py +41 -0
  365. dit-2.2/tests/multivariate/secret_key_agreement/test_two_part_intrinsic_mutual_information.py +82 -0
  366. dit-2.2/tests/multivariate/secret_key_agreement/test_two_way_skar.py +30 -0
  367. dit-2.2/tests/multivariate/test_caekl_mutual_information.py +51 -0
  368. dit-2.2/tests/multivariate/test_cohesion.py +60 -0
  369. dit-2.2/tests/multivariate/test_coinformation.py +73 -0
  370. dit-2.2/tests/multivariate/test_cross_mutual_information.py +100 -0
  371. dit-2.2/tests/multivariate/test_delta_gamma.py +286 -0
  372. dit-2.2/tests/multivariate/test_deweese.py +58 -0
  373. dit-2.2/tests/multivariate/test_dual_total_correlation.py +115 -0
  374. dit-2.2/tests/multivariate/test_entropy.py +71 -0
  375. dit-2.2/tests/multivariate/test_interaction_information.py +38 -0
  376. dit-2.2/tests/multivariate/test_logarithmic_decomposition.py +410 -0
  377. dit-2.2/tests/multivariate/test_mmi_psp.py +62 -0
  378. dit-2.2/tests/multivariate/test_mutual_informations.py +28 -0
  379. dit-2.2/tests/multivariate/test_necessary_conditional_entropy.py +16 -0
  380. dit-2.2/tests/multivariate/test_o_information.py +29 -0
  381. dit-2.2/tests/multivariate/test_quax_synergy.py +145 -0
  382. dit-2.2/tests/multivariate/test_s_information.py +56 -0
  383. dit-2.2/tests/multivariate/test_synergistic_disclosure.py +174 -0
  384. dit-2.2/tests/multivariate/test_total_correlation.py +74 -0
  385. dit-2.2/tests/multivariate/test_transmission.py +67 -0
  386. dit-2.2/tests/multivariate/test_tse_complexity.py +30 -0
  387. dit-2.2/tests/multivariate/test_union_information.py +160 -0
  388. dit-2.2/tests/other/__init__.py +3 -0
  389. dit-2.2/tests/other/test_cumulative_residual_entropy.py +195 -0
  390. dit-2.2/tests/other/test_disequilibrium.py +123 -0
  391. dit-2.2/tests/other/test_extropy.py +95 -0
  392. dit-2.2/tests/other/test_lautum_information.py +18 -0
  393. dit-2.2/tests/other/test_negentropy.py +62 -0
  394. dit-2.2/tests/other/test_perplexity.py +56 -0
  395. dit-2.2/tests/other/test_renyi_entropy.py +41 -0
  396. dit-2.2/tests/other/test_sibson_mutual_information.py +128 -0
  397. dit-2.2/tests/other/test_tsallis_entropy.py +22 -0
  398. dit-2.2/tests/pid/__init__.py +3 -0
  399. dit-2.2/tests/pid/test_hcs.py +137 -0
  400. dit-2.2/tests/pid/test_hmos.py +175 -0
  401. dit-2.2/tests/pid/test_ibroja.py +73 -0
  402. dit-2.2/tests/pid/test_iccs.py +89 -0
  403. dit-2.2/tests/pid/test_ict.py +56 -0
  404. dit-2.2/tests/pid/test_ideg.py +106 -0
  405. dit-2.2/tests/pid/test_idelta.py +45 -0
  406. dit-2.2/tests/pid/test_idep.py +80 -0
  407. dit-2.2/tests/pid/test_ido.py +121 -0
  408. dit-2.2/tests/pid/test_igh.py +60 -0
  409. dit-2.2/tests/pid/test_iig.py +59 -0
  410. dit-2.2/tests/pid/test_iipid.py +92 -0
  411. dit-2.2/tests/pid/test_imc.py +121 -0
  412. dit-2.2/tests/pid/test_imes.py +21 -0
  413. dit-2.2/tests/pid/test_imin.py +48 -0
  414. dit-2.2/tests/pid/test_immi.py +37 -0
  415. dit-2.2/tests/pid/test_ipm.py +172 -0
  416. dit-2.2/tests/pid/test_iprec.py +65 -0
  417. dit-2.2/tests/pid/test_iproj.py +46 -0
  418. dit-2.2/tests/pid/test_irav.py +83 -0
  419. dit-2.2/tests/pid/test_irdr.py +60 -0
  420. dit-2.2/tests/pid/test_irr.py +35 -0
  421. dit-2.2/tests/pid/test_iskar.py +77 -0
  422. dit-2.2/tests/pid/test_isx.py +244 -0
  423. dit-2.2/tests/pid/test_iwedge.py +35 -0
  424. dit-2.2/tests/pid/test_modified_syndisc.py +148 -0
  425. dit-2.2/tests/pid/test_pid_distribution.py +178 -0
  426. dit-2.2/tests/pid/test_syndisc.py +175 -0
  427. dit-2.2/tests/pid/test_syndisc_fast.py +128 -0
  428. dit-2.2/tests/pid/test_syndisc_lattice.py +124 -0
  429. dit-2.2/tests/profiles/__init__.py +3 -0
  430. dit-2.2/tests/profiles/test_base_profile.py +34 -0
  431. dit-2.2/tests/profiles/test_complexity_profile.py +30 -0
  432. dit-2.2/tests/profiles/test_entropy_triangle.py +71 -0
  433. dit-2.2/tests/profiles/test_information_partitions.py +162 -0
  434. dit-2.2/tests/profiles/test_mui.py +46 -0
  435. dit-2.2/tests/profiles/test_schneidman.py +49 -0
  436. dit-2.2/tests/profiles/test_shapley_info_decomposition.py +82 -0
  437. dit-2.2/tests/rate_distortion/__init__.py +3 -0
  438. dit-2.2/tests/rate_distortion/test_bottleneck_algorithms.py +83 -0
  439. dit-2.2/tests/rate_distortion/test_curves.py +174 -0
  440. dit-2.2/tests/rate_distortion/test_gray_wyner.py +175 -0
  441. dit-2.2/tests/rate_distortion/test_ib.py +92 -0
  442. dit-2.2/tests/rate_distortion/test_rd.py +18 -0
  443. dit-2.2/tests/shannon/__init__.py +3 -0
  444. dit-2.2/tests/shannon/test_shannon.py +89 -0
  445. dit-2.2/tests/symbolic/__init__.py +0 -0
  446. dit-2.2/tests/symbolic/test_common_information.py +142 -0
  447. dit-2.2/tests/symbolic/test_cross_validation.py +362 -0
  448. dit-2.2/tests/symbolic/test_symbolic.py +209 -0
  449. dit-2.2/tests/test_abstractdist.py +69 -0
  450. dit-2.2/tests/test_bgm.py +166 -0
  451. dit-2.2/tests/test_cdisthelpers.py +61 -0
  452. dit-2.2/tests/test_distconst.py +508 -0
  453. dit-2.2/tests/test_distribution.py +1630 -0
  454. dit-2.2/tests/test_distribution_coverage.py +447 -0
  455. dit-2.2/tests/test_exceptions.py +137 -0
  456. dit-2.2/tests/test_helpers.py +122 -0
  457. dit-2.2/tests/test_inequalities.py +286 -0
  458. dit-2.2/tests/test_params.py +82 -0
  459. dit-2.2/tests/test_samplespace.py +184 -0
  460. dit-2.2/tests/test_validate.py +101 -0
  461. dit-2.2/tests/utils/__init__.py +3 -0
  462. dit-2.2/tests/utils/test_bindargs.py +35 -0
  463. dit-2.2/tests/utils/test_bindargs3.py +42 -0
  464. dit-2.2/tests/utils/test_context.py +56 -0
  465. dit-2.2/tests/utils/test_latexarray.py +74 -0
  466. dit-2.2/tests/utils/test_misc.py +152 -0
  467. dit-2.2/tests/utils/test_optimization.py +23 -0
  468. dit-2.2/tests/utils/test_table.py +21 -0
  469. dit-2.2/tests/utils/test_testing.py +115 -0
  470. dit-2.2/tests/utils/test_units.py +62 -0
  471. dit-2.2/tests/visualization/__init__.py +3 -0
  472. dit-2.2/tests/visualization/test_upset.py +165 -0
  473. dit-1.5/MANIFEST.in +0 -10
  474. dit-1.5/PKG-INFO +0 -387
  475. dit-1.5/README.rst +0 -361
  476. dit-1.5/dit/__init__.py +0 -36
  477. dit-1.5/dit/abc.py +0 -84
  478. dit-1.5/dit/algorithms/channelcapacity.py +0 -147
  479. dit-1.5/dit/algorithms/convex_maximization.py +0 -83
  480. dit-1.5/dit/algorithms/optimization.py +0 -1503
  481. dit-1.5/dit/algorithms/stats.py +0 -178
  482. dit-1.5/dit/cdisthelpers.py +0 -140
  483. dit-1.5/dit/convert.py +0 -83
  484. dit-1.5/dit/distribution.py +0 -804
  485. dit-1.5/dit/divergences/coupling_metrics.py +0 -98
  486. dit-1.5/dit/divergences/earth_movers_distance.py +0 -128
  487. dit-1.5/dit/divergences/hypercontractivity_coefficient.py +0 -143
  488. dit-1.5/dit/example_dists/intrinsic.py +0 -28
  489. dit-1.5/dit/example_dists/mdbsi.py +0 -18
  490. dit-1.5/dit/example_dists/miscellaneous.py +0 -13
  491. dit-1.5/dit/math/__init__.py +0 -23
  492. dit-1.5/dit/multivariate/common_informations/base_markov_optimizer.py +0 -277
  493. dit-1.5/dit/multivariate/common_informations/functional_common_information.py +0 -194
  494. dit-1.5/dit/multivariate/secret_key_agreement/__init__.py +0 -45
  495. dit-1.5/dit/multivariate/secret_key_agreement/skar_lower_bounds.py +0 -88
  496. dit-1.5/dit/multivariate/secret_key_agreement/trivial_bounds.py +0 -167
  497. dit-1.5/dit/npdist.py +0 -1542
  498. dit-1.5/dit/npscalardist.py +0 -1867
  499. dit-1.5/dit/other/disequilibrium.py +0 -96
  500. dit-1.5/dit/other/perplexity.py +0 -56
  501. dit-1.5/dit/other/renyi_entropy.py +0 -180
  502. dit-1.5/dit/pid/distributions/__init__.py +0 -53
  503. dit-1.5/dit/pid/distributions/bivariate.py +0 -122
  504. dit-1.5/dit/pid/distributions/trivariate.py +0 -68
  505. dit-1.5/dit/pid/helpers.py +0 -52
  506. dit-1.5/dit/pid/measures/ipm.py +0 -43
  507. dit-1.5/dit/rate_distortion/__init__.py +0 -6
  508. dit-1.5/dit/rate_distortion/distortions.py +0 -49
  509. dit-1.5/dit/shannon/__init__.py +0 -8
  510. dit-1.5/dit/utils/logger.py +0 -54
  511. dit-1.5/dit.egg-info/SOURCES.txt +0 -176
  512. dit-1.5/dit.egg-info/dependency_links.txt +0 -1
  513. dit-1.5/dit.egg-info/requires.txt +0 -8
  514. dit-1.5/dit.egg-info/top_level.txt +0 -1
  515. dit-1.5/pyproject.toml +0 -109
  516. dit-1.5/pytest.ini +0 -7
  517. dit-1.5/requirements.txt +0 -8
  518. dit-1.5/requirements_optional.txt +0 -9
  519. dit-1.5/requirements_testing.txt +0 -8
  520. dit-1.5/setup.cfg +0 -11
  521. dit-1.5/setup.py +0 -223
  522. {dit-1.5 → dit-2.2}/CREDITS.rst +0 -0
  523. {dit-1.5 → dit-2.2}/LICENSE.txt +0 -0
  524. {dit-1.5 → dit-2.2}/dit/inference/counts.h +0 -0
dit-2.2/.gitignore ADDED
@@ -0,0 +1,63 @@
1
+ # Python related
2
+ *.pyc
3
+ *.pyo
4
+ *.so
5
+
6
+ # Creating during installation
7
+ MANIFEST
8
+ build/
9
+ dist/
10
+ dit.egg-info/
11
+
12
+ # gedit
13
+ *.*~
14
+
15
+ # known autogenerated .c files
16
+ *.o
17
+
18
+ dit/math/_close.c
19
+ dit/math/_samplediscrete.c
20
+ dit/math/_*.html
21
+
22
+ # ignore coverage information
23
+ .coverage*
24
+ coverage.xml
25
+
26
+ # ignore project files for various IDEs
27
+
28
+ # komodo
29
+ *.kpf
30
+ *.komodoproject
31
+ .komodotools
32
+
33
+ # geany
34
+ *.geany
35
+
36
+ # ignore rope's project directory...
37
+ .ropeproject
38
+
39
+ # vscode
40
+ .vscode
41
+
42
+ # cursor
43
+ .cursor/
44
+
45
+ # vim
46
+ *.swp
47
+ *.swo
48
+
49
+ # ignore the documentation build directory
50
+ docs/_build/
51
+ docs/images/idiagrams.pdf
52
+ docs/images/*.png
53
+ .idea/
54
+ .cache/
55
+ .hypothesis/
56
+ .pypirc
57
+ .pytest_cache/
58
+ .vscode
59
+ dit/inference/pycounts.c
60
+ .mypy_cache
61
+ dit.code-workspace
62
+ newrelic_agent.log
63
+ __marimo__
dit-2.2/PKG-INFO ADDED
@@ -0,0 +1,494 @@
1
+ Metadata-Version: 2.4
2
+ Name: dit
3
+ Version: 2.2
4
+ Summary: Python package for information theory on discrete random variables.
5
+ Project-URL: Homepage, http://dit.io
6
+ Project-URL: Repository, https://github.com/dit/dit
7
+ Project-URL: Documentation, http://docs.dit.io
8
+ Author-email: chebee7i <admin@dit.io>, "Ryan G. James" <dit@autoplectic.com>
9
+ License-Expression: BSD-3-Clause
10
+ License-File: LICENSE.txt
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: boltons
24
+ Requires-Dist: debtcollector
25
+ Requires-Dist: lattices>=0.5
26
+ Requires-Dist: loguru
27
+ Requires-Dist: networkx>=2.6
28
+ Requires-Dist: numpy>=1.22
29
+ Requires-Dist: pltable
30
+ Requires-Dist: scipy>=1.7
31
+ Requires-Dist: xarray
32
+ Provides-Extra: broja
33
+ Requires-Dist: ecos; extra == 'broja'
34
+ Provides-Extra: dev
35
+ Requires-Dist: colorama; extra == 'dev'
36
+ Requires-Dist: hypothesis; extra == 'dev'
37
+ Requires-Dist: hypothesis>=6.0; extra == 'dev'
38
+ Requires-Dist: hypothesis[numpy]; extra == 'dev'
39
+ Requires-Dist: ipython; extra == 'dev'
40
+ Requires-Dist: jax; extra == 'dev'
41
+ Requires-Dist: jaxlib; extra == 'dev'
42
+ Requires-Dist: matplotlib; extra == 'dev'
43
+ Requires-Dist: nbconvert; extra == 'dev'
44
+ Requires-Dist: numdifftools; extra == 'dev'
45
+ Requires-Dist: optimistix; extra == 'dev'
46
+ Requires-Dist: pint; extra == 'dev'
47
+ Requires-Dist: pycddlib-standalone; extra == 'dev'
48
+ Requires-Dist: pypoman; extra == 'dev'
49
+ Requires-Dist: pytensor; extra == 'dev'
50
+ Requires-Dist: pytest-cov; extra == 'dev'
51
+ Requires-Dist: pytest-rerunfailures; extra == 'dev'
52
+ Requires-Dist: pytest-sugar; extra == 'dev'
53
+ Requires-Dist: pytest-xdist; extra == 'dev'
54
+ Requires-Dist: pytest>=9.0.3; extra == 'dev'
55
+ Requires-Dist: python-ternary; extra == 'dev'
56
+ Requires-Dist: ruff; extra == 'dev'
57
+ Requires-Dist: scikit-learn; extra == 'dev'
58
+ Requires-Dist: slsqp-jax; extra == 'dev'
59
+ Requires-Dist: sphinx; extra == 'dev'
60
+ Requires-Dist: sphinx-rtd-theme; extra == 'dev'
61
+ Requires-Dist: sphinxcontrib-bibtex; extra == 'dev'
62
+ Requires-Dist: sympy; extra == 'dev'
63
+ Requires-Dist: torch; extra == 'dev'
64
+ Requires-Dist: ty; extra == 'dev'
65
+ Provides-Extra: docs
66
+ Requires-Dist: colorama; extra == 'docs'
67
+ Requires-Dist: hypothesis; extra == 'docs'
68
+ Requires-Dist: ipython; extra == 'docs'
69
+ Requires-Dist: matplotlib; extra == 'docs'
70
+ Requires-Dist: nbconvert; extra == 'docs'
71
+ Requires-Dist: numdifftools; extra == 'docs'
72
+ Requires-Dist: pint; extra == 'docs'
73
+ Requires-Dist: pycddlib-standalone; extra == 'docs'
74
+ Requires-Dist: python-ternary; extra == 'docs'
75
+ Requires-Dist: scikit-learn; extra == 'docs'
76
+ Requires-Dist: sphinx; extra == 'docs'
77
+ Requires-Dist: sphinx-rtd-theme; extra == 'docs'
78
+ Requires-Dist: sphinxcontrib-bibtex; extra == 'docs'
79
+ Requires-Dist: sympy; extra == 'docs'
80
+ Provides-Extra: jax
81
+ Requires-Dist: jax; extra == 'jax'
82
+ Requires-Dist: jaxlib; extra == 'jax'
83
+ Requires-Dist: optimistix; extra == 'jax'
84
+ Requires-Dist: slsqp-jax; extra == 'jax'
85
+ Provides-Extra: music
86
+ Requires-Dist: music21; extra == 'music'
87
+ Provides-Extra: optional
88
+ Requires-Dist: colorama; extra == 'optional'
89
+ Requires-Dist: matplotlib; extra == 'optional'
90
+ Requires-Dist: numdifftools; extra == 'optional'
91
+ Requires-Dist: pint; extra == 'optional'
92
+ Requires-Dist: pycddlib-standalone; extra == 'optional'
93
+ Requires-Dist: pypoman; extra == 'optional'
94
+ Requires-Dist: scikit-learn; extra == 'optional'
95
+ Provides-Extra: pytensor
96
+ Requires-Dist: pytensor; extra == 'pytensor'
97
+ Provides-Extra: symbolic
98
+ Requires-Dist: sympy; extra == 'symbolic'
99
+ Provides-Extra: test
100
+ Requires-Dist: hypothesis>=6.0; extra == 'test'
101
+ Requires-Dist: hypothesis[numpy]; extra == 'test'
102
+ Requires-Dist: pytest-cov; extra == 'test'
103
+ Requires-Dist: pytest-rerunfailures; extra == 'test'
104
+ Requires-Dist: pytest-sugar; extra == 'test'
105
+ Requires-Dist: pytest-xdist; extra == 'test'
106
+ Requires-Dist: pytest>=9.0.3; extra == 'test'
107
+ Provides-Extra: torch
108
+ Requires-Dist: torch; extra == 'torch'
109
+ Description-Content-Type: text/x-rst
110
+
111
+ ``dit`` is a Python package for information theory.
112
+
113
+ |build| |codecov| |docs| |conda|
114
+
115
+ |joss| |zenodo| |slack|
116
+
117
+ Introduction
118
+ ------------
119
+
120
+ Information theory is a powerful extension to probability and statistics, quantifying dependencies
121
+ among arbitrary random variables in a way that is consistent and comparable across systems and
122
+ scales. Information theory was originally developed to quantify how quickly and reliably information
123
+ could be transmitted across an arbitrary channel. The demands of modern, data-driven science have
124
+ been coopting and extending these quantities and methods into unknown, multivariate settings where
125
+ the interpretation and best practices are not known. For example, there are at least four reasonable
126
+ multivariate generalizations of the mutual information, none of which inherit all the
127
+ interpretations of the standard bivariate case. Which is best to use is context-dependent. ``dit``
128
+ implements a vast range of multivariate information measures in an effort to allow information
129
+ practitioners to study how these various measures behave and interact in a variety of contexts. We
130
+ hope that having all these measures and techniques implemented in one place will allow the
131
+ development of robust techniques for the automated quantification of dependencies within a system
132
+ and concrete interpretation of what those dependencies mean.
133
+
134
+ Citing
135
+ ------
136
+
137
+ If you use `dit` in your research, please cite it as::
138
+
139
+ @article{dit,
140
+ Author = {James, R. G. and Ellison, C. J. and Crutchfield, J. P.},
141
+ Title = {{dit}: a {P}ython package for discrete information theory},
142
+ Journal = {The Journal of Open Source Software},
143
+ Volume = {3},
144
+ Number = {25},
145
+ Pages = {738},
146
+ Year = {2018},
147
+ Doi = {https://doi.org/10.21105/joss.00738}
148
+ }
149
+
150
+ Basic Information
151
+ -----------------
152
+
153
+ Documentation
154
+ *************
155
+
156
+ http://docs.dit.io
157
+
158
+ Downloads
159
+ *********
160
+
161
+ https://pypi.org/project/dit/
162
+
163
+ https://anaconda.org/conda-forge/dit
164
+
165
+ +-------------------------------------------------------------------+
166
+ | Dependencies |
167
+ +===================================================================+
168
+ | * Python 3.11+ |
169
+ | * `boltons <https://boltons.readthedocs.io>`_ |
170
+ | * `debtcollector <https://docs.openstack.org/debtcollector/>`_ |
171
+ | * `lattices <https://github.com/dit/lattices>`_ |
172
+ | * `loguru <https://loguru.readthedocs.io>`_ |
173
+ | * `networkx <https://networkx.github.io/>`_ |
174
+ | * `numpy <http://www.numpy.org/>`_ |
175
+ | * `PLTable <https://github.com/platomav/PLTable>`_ |
176
+ | * `scipy <https://www.scipy.org/>`_ |
177
+ | * `xarray <https://docs.xarray.dev/>`_ |
178
+ +-------------------------------------------------------------------+
179
+
180
+ Optional Dependencies
181
+ ~~~~~~~~~~~~~~~~~~~~~
182
+ * colorama: colored column heads in PID indicating failure modes
183
+ * cython: faster sampling from distributions
184
+ * hypothesis: random sampling of distributions
185
+ * jax, jaxlib: JAX-based optimization backend with autodiff support
186
+ * matplotlib, python-ternary: plotting of various information-theoretic expansions
187
+ * numdifftools: numerical evaluation of gradients and hessians during optimization
188
+ * pint: add units to informational values
189
+ * pycddlib-standalone, pypoman: polytope vertex enumeration for convex-maximization-based measures
190
+ * pytensor: PyTensor-based optimization backend with autodiff support
191
+ * scikit-learn: faster nearest-neighbor lookups during entropy/mutual information estimation from samples
192
+ * torch: PyTorch-based optimization backend with autodiff and GPU support
193
+
194
+ Install
195
+ *******
196
+
197
+ The easiest way to install is:
198
+
199
+ .. code-block:: bash
200
+
201
+ pip install dit
202
+
203
+ If you want to install ``dit`` within a conda environment, you can simply do:
204
+
205
+ .. code-block:: bash
206
+
207
+ conda install -c conda-forge dit
208
+
209
+ For development, we recommend `uv <https://docs.astral.sh/uv/>`_:
210
+
211
+ .. code-block:: bash
212
+
213
+ git clone https://github.com/dit/dit.git
214
+ cd dit
215
+ uv sync --extra dev
216
+
217
+ This installs ``dit`` in editable mode with all development dependencies
218
+ (tests, docs, linting, type checking, and optional backends).
219
+
220
+ Testing
221
+ *******
222
+
223
+ .. code-block:: bash
224
+
225
+ # Using uv (recommended)
226
+ uv run pytest
227
+
228
+ # Or with pip
229
+ pip install -e ".[test]"
230
+ pytest
231
+
232
+ Code and bug tracker
233
+ ********************
234
+
235
+ https://github.com/dit/dit
236
+
237
+ License
238
+ *******
239
+
240
+ BSD 3-Clause, see LICENSE.txt for details.
241
+
242
+ Implemented Measures
243
+ --------------------
244
+
245
+ ``dit`` implements the following information measures. Most of these are implemented in multivariate & conditional
246
+ generality, where such generalizations either exist in the literature or are relatively obvious --- for example,
247
+ though it is not in the literature, the multivariate conditional exact common information is implemented here.
248
+
249
+ +------------------------------------------+-----------------------------------------+-----------------------------------+
250
+ | Entropies | Mutual Informations | Divergences |
251
+ | | | |
252
+ | * Shannon Entropy | * Co-Information | * Variational Distance |
253
+ | * Renyi Entropy | * Interaction Information | * Kullback-Leibler Divergence / |
254
+ | * Tsallis Entropy | * Total Correlation / Multi-Information | Relative Entropy |
255
+ | * Necessary Conditional Entropy | * Dual Total Correlation / Binding | * Cross Entropy |
256
+ | * Residual Entropy / Independent | Information | * Jensen-Shannon Divergence |
257
+ | Information / Variation of Information | * CAEKL Multivariate Mutual Information | * Earth Mover's Distance |
258
+ +------------------------------------------+ * O-Information +-----------------------------------+
259
+ | Common Informations | * Cohesion | Other Measures |
260
+ | | * Transmission | |
261
+ | * Gacs-Korner Common Information | * Union Information | * Channel Capacity |
262
+ | * Wyner Common Information | * Logarithmic Decomposition | * Complexity Profile |
263
+ | * Exact Common Information | * Delta^k / Gamma^k | * Connected Informations |
264
+ | * Functional Common Information | * DeWeese Mutual Information | * Copy Mutual Information |
265
+ | * MSS Common Information +-----------------------------------------+ * Cumulative Residual Entropy |
266
+ | * Kamath-Anantharam Dual Common | Partial Information Decomposition | * Extropy |
267
+ | Information | | * Hypercontractivity Coefficient |
268
+ | * Beta Common Information | * :math:`I_{min}` | * Information Bottleneck |
269
+ | * Salamatian-Cohen-Medard Maximum Entropy| * :math:`I_{\wedge}` | * Information Diagrams |
270
+ | Function | * :math:`I_{RR}` | * Information Trimming |
271
+ +------------------------------------------+ * :math:`I_{\downarrow}` | * Lautum Information |
272
+ | Secret Key Agreement Bounds | * :math:`I_{proj}` | * LMPR Complexity |
273
+ | | * :math:`I_{BROJA}` | * Marginal Utility of Information |
274
+ | * Secrecy Capacity | * :math:`I_{ccs}` | * Maximum Correlation |
275
+ | * Intrinsic Mutual Information | * :math:`I_{\pm}` | * Maximum Entropy Distributions |
276
+ | * Reduced Intrinsic Mutual Information | * :math:`I_{sx}` | * Perplexity |
277
+ | * Minimal Intrinsic Mutual Information | * :math:`I_{dep}` | * Rate-Distortion Theory |
278
+ | * Necessary Intrinsic Mutual Information | * :math:`I_{RAV}` | * TSE Complexity |
279
+ | * Two-Part Intrinsic Mutual Information | * :math:`I_{mmi}` | * Gray-Wyner Network |
280
+ | | * :math:`I_{\prec}` | |
281
+ | | * :math:`I_{RA}` | |
282
+ | | * :math:`I_{SKAR}` | |
283
+ | | * :math:`I_{IG}` | |
284
+ | | * :math:`I_{RDR}` | |
285
+ | | * :math:`I_{do}` | |
286
+ +------------------------------------------+-----------------------------------------+-----------------------------------+
287
+
288
+ Quickstart
289
+ ----------
290
+
291
+ The basic usage of ``dit`` corresponds to creating distributions, modifying them
292
+ if need be, and then computing properties of those distributions. First, we
293
+ import:
294
+
295
+ .. code:: python
296
+
297
+ >>> import dit
298
+
299
+ Suppose we have a really thick coin, one so thick that there is a reasonable
300
+ chance of it landing on its edge. Here is how we might represent the coin in
301
+ ``dit``.
302
+
303
+ .. code:: python
304
+
305
+ >>> d = dit.Distribution(['H', 'T', 'E'], [.4, .4, .2])
306
+ >>> print(d)
307
+ Class: Distribution
308
+ Alphabet: ('E', 'H', 'T') for all rvs
309
+ Base: linear
310
+ Outcome Class: str
311
+ Outcome Length: 1
312
+ RV Names: None
313
+
314
+ x p(x)
315
+ E 0.2
316
+ H 0.4
317
+ T 0.4
318
+
319
+ Calculate the probability of ``H`` and also of the combination ``H or T``.
320
+
321
+ .. code:: python
322
+
323
+ >>> d['H']
324
+ 0.4
325
+ >>> d.event_probability(['H','T'])
326
+ 0.8
327
+
328
+ Calculate the Shannon entropy and extropy of the joint distribution.
329
+
330
+ .. code:: python
331
+
332
+ >>> dit.shannon.entropy(d)
333
+ 1.5219280948873621
334
+ >>> dit.other.extropy(d)
335
+ 1.1419011889093373
336
+
337
+ Create a distribution where ``Z = xor(X, Y)``.
338
+
339
+ .. code:: python
340
+
341
+ >>> import dit.example_dists
342
+ >>> d = dit.example_dists.Xor()
343
+ >>> d.set_rv_names(['X', 'Y', 'Z'])
344
+ >>> print(d)
345
+ Class: Distribution
346
+ Alphabet: ('0', '1') for all rvs
347
+ Base: linear
348
+ Outcome Class: str
349
+ Outcome Length: 3
350
+ RV Names: ('X', 'Y', 'Z')
351
+
352
+ x p(x)
353
+ 000 0.25
354
+ 011 0.25
355
+ 101 0.25
356
+ 110 0.25
357
+
358
+ Calculate the Shannon mutual informations ``I[X:Z]``, ``I[Y:Z]``, and
359
+ ``I[X,Y:Z]``.
360
+
361
+ .. code:: python
362
+
363
+ >>> dit.shannon.mutual_information(d, ['X'], ['Z'])
364
+ 0.0
365
+ >>> dit.shannon.mutual_information(d, ['Y'], ['Z'])
366
+ 0.0
367
+ >>> dit.shannon.mutual_information(d, ['X', 'Y'], ['Z'])
368
+ 1.0
369
+
370
+ Calculate the marginal distribution ``P(X,Z)``.
371
+ Then print its probabilities as fractions, showing the mask.
372
+
373
+ .. code:: python
374
+
375
+ >>> d2 = d.marginal(['X', 'Z'])
376
+ >>> print(d2.to_string(show_mask=True, exact=True))
377
+ Class: Distribution
378
+ Alphabet: ('0', '1') for all rvs
379
+ Base: linear
380
+ Outcome Class: str
381
+ Outcome Length: 2 (mask: 3)
382
+ RV Names: ('X', 'Z')
383
+
384
+ x p(x)
385
+ 0*0 1/4
386
+ 0*1 1/4
387
+ 1*0 1/4
388
+ 1*1 1/4
389
+
390
+ Convert the distribution probabilities to log (base 3.5) probabilities, and
391
+ access its probability mass function.
392
+
393
+ .. code:: python
394
+
395
+ >>> d2.set_base(3.5)
396
+ >>> d2.pmf
397
+ array([-1.10658951, -1.10658951, -1.10658951, -1.10658951])
398
+
399
+ Draw 5 random samples from this distribution.
400
+
401
+ .. code:: python
402
+
403
+ >>> dit.math.prng.seed(1)
404
+ >>> d2.rand(5)
405
+ ['01', '10', '00', '01', '00']
406
+
407
+ Source and Channel Coding
408
+ -------------------------
409
+
410
+ Beyond measures, ``dit`` builds explicit codes and ships a catalog of channels.
411
+
412
+ The ``dit.coding`` module constructs lossless *source codes* (Shannon, Fano,
413
+ Shannon-Fano-Elias, Huffman, length-limited Huffman, Golomb/Rice, Tunstall, and
414
+ the universal integer codes) and reports their code-theoretic properties (rate,
415
+ redundancy, efficiency, the Kraft sum, and whether the code is prefix-free /
416
+ uniquely decodable / optimal).
417
+
418
+ .. code:: python
419
+
420
+ >>> from dit.coding import huffman
421
+ >>> d = dit.Distribution(['a', 'b', 'c', 'd', 'e'], [0.4, 0.2, 0.2, 0.1, 0.1])
422
+ >>> code = huffman(d)
423
+ >>> code.average_length()
424
+ 2.2
425
+ >>> float(code.source_entropy())
426
+ 2.1219280948873624
427
+ >>> code.is_optimal(), code.is_prefix_free()
428
+ (True, True)
429
+
430
+ It also builds binary (GF(2)) *channel codes* --- linear block codes
431
+ (repetition, parity-check, Hamming, Reed-Muller, Golay) as well as LDPC, polar,
432
+ and convolutional codes --- and evaluates them against a noisy channel supplied
433
+ as a conditional ``Distribution`` ``p(Y|X)``.
434
+
435
+ .. code:: python
436
+
437
+ >>> from dit.coding import hamming
438
+ >>> code = hamming(3)
439
+ >>> code.length, code.dimension, code.minimum_distance()
440
+ (7, 4, 3)
441
+ >>> bsc = dit.example_channels.binary_symmetric_channel(0.05)
442
+ >>> float(code.probability_of_error(bsc, method='exact'))
443
+ 0.04438054218749993
444
+
445
+ The ``dit.example_channels`` module is a catalog of canonical discrete
446
+ memoryless channels (binary symmetric, binary erasure, Z-channel, q-ary
447
+ symmetric/erasure, noisy typewriter, ...). Each constructor returns a
448
+ conditional ``Distribution`` ``p(Y|X)`` ready for
449
+ ``dit.algorithms.channel_capacity`` or the coding layer above.
450
+
451
+ .. code:: python
452
+
453
+ >>> from dit.algorithms import channel_capacity
454
+ >>> bec = dit.example_channels.binary_erasure_channel(0.25)
455
+ >>> float(channel_capacity(bec)[0])
456
+ 0.75
457
+
458
+ Contributions & Help
459
+ --------------------
460
+
461
+ If you'd like to feature added to ``dit``, please file an issue. Or, better yet, open a pull request. Ideally, all code should be tested and documented, but please don't let this be a barrier to contributing. We'll work with you to ensure that all pull requests are in a mergable state.
462
+
463
+ If you'd like to get in contact about anything, you can reach us through our `slack channel <https://dit-python.slack.com/>`_.
464
+
465
+
466
+ .. badges:
467
+
468
+ .. |build| image:: https://github.com/dit/dit/actions/workflows/build.yml/badge.svg
469
+ :target: https://github.com/dit/dit/actions/workflows/build.yml
470
+ :alt: Continuous Integration Status
471
+
472
+ .. |codecov| image:: https://codecov.io/gh/dit/dit/branch/main/graph/badge.svg
473
+ :target: https://codecov.io/gh/dit/dit
474
+ :alt: Test Coverage Status
475
+
476
+ .. |docs| image:: https://readthedocs.org/projects/dit/badge/?version=latest
477
+ :target: http://dit.readthedocs.org/en/latest/?badge=latest
478
+ :alt: Documentation Status
479
+
480
+ .. |conda| image:: https://anaconda.org/conda-forge/dit/badges/installer/conda.svg
481
+ :target: https://anaconda.org/conda-forge/dit
482
+ :alt: Conda installation
483
+
484
+ .. |zenodo| image:: https://zenodo.org/badge/13201610.svg
485
+ :target: https://zenodo.org/badge/latestdoi/13201610
486
+ :alt: DOI
487
+
488
+ .. |slack| image:: https://img.shields.io/badge/Slack-dit--python-lightgrey.svg
489
+ :target: https://dit-python.slack.com/
490
+ :alt: dit chat
491
+
492
+ .. |joss| image:: http://joss.theoj.org/papers/10.21105/joss.00738/status.svg
493
+ :target: https://doi.org/10.21105/joss.00738
494
+ :alt: JOSS Status