cds2.infotheory
Entropy, divergence and dependence measures.
Information theory: entropy, divergence and dependence measures.
entropy(probabilities, base=2.0)
Shannon entropy of a discrete distribution in units of base.
Source code in src/cds2/infotheory.py
61 62 63 | |
joint_entropy(joint, base=2.0)
Entropy of a joint distribution given as a 2-D probability table.
Source code in src/cds2/infotheory.py
66 67 68 69 | |
conditional_entropy(joint, marginal=None, base=2.0)
H(Y|X) from a joint P(X, Y) table (rows indexed by X).
Source code in src/cds2/infotheory.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
kl_divergence(p, q, base=2.0)
Kullback-Leibler divergence D_KL(P || Q), with zero terms where P is 0.
Source code in src/cds2/infotheory.py
108 109 110 111 112 113 114 115 116 117 118 | |
js_divergence(p, q, base=2.0)
Jensen-Shannon divergence between P and Q (symmetric, bounded).
Source code in src/cds2/infotheory.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
cross_entropy(p, q, base=2.0)
Cross-entropy H(P, Q) = H(P) + D_KL(P || Q).
Source code in src/cds2/infotheory.py
137 138 139 140 141 142 143 144 145 146 147 | |
mutual_information(joint, base=2.0)
Mutual information I(X; Y) from a joint P(X, Y) table.
Source code in src/cds2/infotheory.py
159 160 161 | |
normalized_mutual_information(joint, base=2.0)
I(X; Y) scaled into [0, 1] by the square-root entropy product.
Source code in src/cds2/infotheory.py
164 165 166 167 168 169 170 171 172 173 174 175 176 | |
permutation_entropy(signal, order=3, delay=1, base=2.0)
Bandt-Pompe permutation entropy of an ordinal-pattern histogram.
Source code in src/cds2/infotheory.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |