Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
A second correctness review: every fix below was reproduced against a
brute-force reference or a closed-form value and has a regression test.

### Generator cardinality

- Minimal generators can need more than `min(|S+|, |S-|) + 1` states. The skip-one chain (the first-order Markov
chain on `Z_6` moving `i -> i + 1` or `i + 2`, with light cells `1e-3`) has `|S+| = |S-| = 6`, vanishing
persistent crypticities, and `C_g = G[S+ : S-] = 2.037622` with 8 states; 7 states give at least 2.269805. The
remarks in `global_bound` and the docs that every certified case needs at most `|S+| + 1` states are replaced,
and `global_bound_states` (default `min(|S+|, |S-|) + 1`) is documented as a convention, not a bound.
- New `generator_bounds.one_wide_exact_common_information(P)`: exact `G[X : Y]` when every rectangle in the support
lies in one row or one column, by enumerating row-or-column assignments of the cells on each connected component;
`by_terms[k]` gives the optimum with at most `k` values. The skip-one chain is its regression test.
- `separating_optima` tries at most `min(m, 8)` terms, `m` the number of support cells: Kumar, Li & El Gamal's
argument restricted to the support bounds the terms of some optimum by `m` (was `|S+| |S-|`).
- Citations: `Feldman1998b` now points to Feldman & Crutchfield's "Discovering Noncritical Organization" (Entropy
2022, SFI working paper 1998); `Travers2010` to J. Stat. Phys. 145 (2011). `structural_information` cites
Feldman & Crutchfield (2003) and Travers & Crutchfield's asymptotic synchronization paper (2011);
`predictability_gain` notes that `h_mu(L) - h_mu` is Bialek et al.'s learning curve and Crutchfield & Feldman's
`r(L)`, whose "predictability gain" is the first difference `h_mu(L) - h_mu(L - 1)`.

### Restricted global bound (SCIP)

- New `sofic.generators.global_bound`: `generator_global_bound(bidir, k)` minimizes the state entropy over the
Expand Down
43 changes: 39 additions & 4 deletions docs/generators/generative_models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,35 @@ feeds them to :func:`~sofic.generators.generator_caps.generator_coverage_bound`
on :math:`C_g` from the forward ε-machine alone. On the :math:`(2, \infty)` process a
two-symbol window already gives :math:`C_g \ge 3/2`.

Supports without 2 × 2 rectangles
---------------------------------

When no two forward causal states share two reverse causal states, every rectangle in the support
of the causal-state joint lies in one row or one column, and
:func:`~sofic.generators.generator_bounds.one_wide_exact_common_information` computes
:math:`\op{G}{S^+ : S^-}` exactly. Every distribution on such a block is a product, so with the
blocks fixed the decompositions form a product of simplices (each cell's mass split among the
blocks covering it), on which the concave entropy is minimized at a vertex: a partition of the
support. Merging two blocks of one row or one column lowers the entropy, so some optimal partition
sends each cell to its row's block or to its column's block; the function enumerates these
assignments on each connected component of the support and also reports the least entropy with at
most ``k`` blocks. Kumar, Li & El Gamal :cite:`Kumar2014` show that some optimal separating
variable has at most :math:`|S^+||S^-|` values (and at most :math:`2^{\min(|S^+|, |S^-|)} - 1`);
their argument restricted to the support gives at most the number of support cells, which caps the
number of terms :func:`~sofic.generators.coupled_generators.separating_optima` tries. The partition
solver is not from the literature.

The skip-one chain shows that a minimal generator can need more than
:math:`\min(|S^+|, |S^-|) + 1` states. It is the first-order Markov chain on :math:`\mathbb{Z}_6`
that moves from :math:`i` to :math:`i + 1` or :math:`i + 2`, with the twelve cells
:math:`(i, i + 1), (i, i + 2)` of the joint of consecutive symbols, in cycle order, weighing heavy,
heavy, light (light cells :math:`10^{-3}`, heavy ones :math:`0.1245`). Its causal states are the
previous and the next symbol, so :math:`|S^+| = |S^-| = 6`. Both persistent crypticities vanish, so
:math:`C_g = \op{G}{S^+ : S^-}`, and the support, a 12-cycle, has no :math:`2 \times 2` rectangle.
The optimum pairs adjacent heavy cells and keeps the light ones apart: 8 blocks and
:math:`C_g = 2.037622`, while 7 blocks give at least :math:`2.269805`. This family has no published
source.

Restricted global bound
-----------------------

Expand All @@ -385,9 +414,11 @@ With the bidirectional edge chain it adds two-step path flows and the two-step e
weights are sorted, so caps on the heaviest states enter as linear cuts, and an objective limit
(the entropy of a verified generator) lets SCIP prune. The result bounds the state entropy of every
generator with at most ``k`` states and says nothing about larger ones. It is therefore a lower
bound on :math:`C_g` only once the number of states of a minimal generator is bounded, which is open
(every certified case so far needs at most :math:`|S^+| + 1` states). It is also numerical, not a
certificate: the equations with data on the right-hand side are relaxed by ``data_tol``, and SCIP
bound on :math:`C_g` only once the number of states of a minimal generator is bounded. No general
bound is known, and :math:`\min(|S^+|, |S^-|) + 1` is not one: the skip-one chain (under
`Supports without 2 × 2 rectangles`_) needs :math:`|S^+| + 2` states. When both persistent
crypticities vanish, ``k`` equal to the number of cells in the support of the causal-state joint
suffices. It is also numerical, not a certificate: the equations with data on the right-hand side are relaxed by ``data_tol``, and SCIP
works to its own tolerances. SCIP's solution satisfies necessary conditions only;
:func:`~sofic.generators.hmm_search.hmm_generator_search` with ``initial`` polishes it into a
generator. On the binary process with symbol matrices
Expand All @@ -398,7 +429,8 @@ generator. On the binary process with symbol matrices
generator with at most 3 states does :math:`10^{-4}` bits better.

The pipeline runs it with ``global_bound=True``, after the belief-free search, for
``global_bound_states`` states (default :math:`\min(|S^+|, |S^-|) + 1`). It gets half the remaining
``global_bound_states`` states (default :math:`\min(|S^+|, |S^-|) + 1`, a convention, not a bound).
It gets half the remaining
budget (120 s without a budget) and the best candidate's entropy as its objective limit, and it is
skipped above 2,000 SCIP variables. The value goes to ``restricted_lower`` and ``restricted_states``,
not to ``lower``, so ``certified`` is unchanged; the polished solution is offered as a candidate. The
Expand Down Expand Up @@ -464,6 +496,9 @@ Coupled generators and bounds
.. autofunction:: sofic.generators.coupled_generators.line_split_seeds
.. autofunction:: sofic.generators.coupled_generators.targeted_line_split_seeds
.. autofunction:: sofic.generators.generator_bounds.support_type_bound
.. autofunction:: sofic.generators.generator_bounds.one_wide_exact_common_information
.. autoclass:: sofic.generators.generator_bounds.OneWidePartitionResult
:members:
.. autofunction:: sofic.generators.generator_bounds.flow_bound
.. autofunction:: sofic.generators.generator_bounds.flow_bound_result
.. autofunction:: sofic.generators.generator_bounds.rll_flow_bound_certified
Expand Down
49 changes: 36 additions & 13 deletions docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -508,13 +508,25 @@ @article{Shalizi1999

@article{Feldman1998b,
author = {Feldman, David P. and Crutchfield, James P.},
title = {Structural Information in Non-Critical Systems},
title = {Discovering Noncritical Organization: Statistical Mechanical, Information Theoretic, and Computational Views of Patterns in One-Dimensional Spin Systems},
journal = {Entropy},
volume = {24},
number = {9},
pages = {1282},
year = {2022},
doi = {10.3390/e24091282},
note = {First appeared as Santa Fe Institute Working Paper 98-04-026 (1998)},
}

@article{Feldman2003,
author = {Feldman, David P. and Crutchfield, James P.},
title = {Structural Information in Two-Dimensional Patterns: {E}ntropy Convergence and Excess Entropy},
journal = {Physical Review E},
volume = {57},
number = {3},
pages = {2459--2464},
year = {1998},
doi = {10.1103/PhysRevE.57.2459},
volume = {67},
number = {5},
pages = {051104},
year = {2003},
doi = {10.1103/PhysRevE.67.051104},
}

@article{riechers2017spectral2,
Expand Down Expand Up @@ -938,18 +950,29 @@ @book{Nasu1995
}

@article{Travers2010,
author = {Travers, Nicholas and Crutchfield, James P.},
author = {Travers, Nicholas F. and Crutchfield, James P.},
title = {Exact Synchronization for Finite-State Sources},
journal = {Chaos},
volume = {20},
number = {3},
pages = {037115},
year = {2010},
doi = {10.1063/1.3485620},
journal = {Journal of Statistical Physics},
volume = {145},
number = {5},
pages = {1181--1201},
year = {2011},
doi = {10.1007/s10955-011-0342-4},
eprint = {1008.4182},
archivePrefix = {arXiv},
}

@article{Travers2011,
author = {Travers, Nicholas F. and Crutchfield, James P.},
title = {Asymptotic Synchronization for Finite-State Sources},
journal = {Journal of Statistical Physics},
volume = {145},
number = {5},
pages = {1202--1223},
year = {2011},
doi = {10.1007/s10955-011-0349-x},
}

@article{Cerny1964,
author = {{\v{C}}ern{\'y}, J{\'a}n},
title = {Pozn{\'a}mka k homog{\'e}nnym experimentom s kone{\v{c}}n{\'y}mi automatmi},
Expand Down
4 changes: 2 additions & 2 deletions sofic/generators/alternative_complexity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
def structural_information(machine: EpsilonMachine) -> float:
"""Structural information, i.e. the excess entropy ``E``.

Feldman & Crutchfield :cite:`Feldman1998b` take the excess entropy
Feldman & Crutchfield :cite:`Feldman2003` take the excess entropy
:math:`E = I[X_{-\\infty:0} : X_{0:\\infty}] = \\lim_{L\\to\\infty}
(H[X_{0:L}] - h_\\mu L)` as the measure of structural information. For an
epsilon-machine it equals the forward/reverse causal-state mutual
information :math:`E = I[S^+ : S^-]` :cite:`Ellison2009`, which is what is
returned. (By contrast the state uncertainty :math:`H[S_L \\mid X_{0:L}]`
vanishes as :math:`L \\to \\infty` for every finite-state epsilon-machine
:cite:`Travers2010`; it does not converge to ``E``.)
:cite:`Travers2011`; it does not converge to ``E``.)
"""
return machine.excess_entropy()

Expand Down
7 changes: 4 additions & 3 deletions sofic/generators/block_entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,11 @@ def _entropy_rate_estimates(entropies: np.ndarray) -> np.ndarray:


def _predictability_gain(block_entropy: np.ndarray, h_mu: float) -> np.ndarray:
"""PG(L) = h_mu(L) - h_mu with h_mu(L) = H(L) - H(L-1) (Bialek et al., 2001).
"""PG(L) = h_mu(L) - h_mu with h_mu(L) = H(L) - H(L-1).

The predictability gain is the excess of the length-``L`` entropy-rate estimate
over the asymptotic entropy rate, not the second difference of the block entropy.
Bialek et al.'s learning curve and Crutchfield & Feldman's per-symbol redundancy r(L); their
"predictability gain" is the second difference of the block entropy, h_mu(L) - h_mu(L-1). See
:meth:`~sofic.generators.epsilon_machine.EpsilonMachine.predictability_gain`.
"""
gain = np.full(len(block_entropy), math.nan, dtype=float)
if len(block_entropy) > 1:
Expand Down
13 changes: 7 additions & 6 deletions sofic/generators/coupled_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,17 +608,18 @@ def separating_optima(
"""Distinct optima of the exact common information ``G[S+ : S-]`` found by multistart exact decomposition.

Runs :func:`_decompose` (SLSQP with exact constraints) from ``starts`` random points for each number of terms in
``sizes`` (default ``2 .. min(|S+| |S-|, 8)``, within the Kumar-Li-El Gamal bound :cite:`Kumar2014`), keeps the
solutions within ``atol`` of the best value, removes duplicates (equal sets of terms up to relabeling) and
returns ``(best value, channels)``. The optimum need not be unique, and only some optima may be generator
states; :func:`generator_kernel` decides which. No new start begins after ``deadline`` (a
:func:`time.monotonic` value) once some decomposition has been found.
``sizes`` (default ``2 .. min(m, 8)``, where ``m`` is the number of cells in the support of the joint: some
optimum has at most ``m`` terms, by Kumar, Li & El Gamal's argument for their bound of ``|S+| |S-|``
:cite:`Kumar2014` restricted to the support), keeps the solutions within ``atol`` of the best value, removes
duplicates (equal sets of terms up to relabeling) and returns ``(best value, channels)``. The optimum need not
be unique, and only some optima may be generator states; :func:`generator_kernel` decides which. No new start
begins after ``deadline`` (a :func:`time.monotonic` value) once some decomposition has been found.
"""
problem = _as_problem(bidir)
rng = rng or np.random.default_rng()
P = _pair_joint(problem)
na, nb = P.shape
sizes = sizes or range(2, min(na * nb, 8) + 1)
sizes = sizes or range(2, min(int(np.count_nonzero(P > 1e-12)), 8) + 1)
found = []
for k in sizes:
for _ in range(starts):
Expand Down
10 changes: 8 additions & 2 deletions sofic/generators/epsilon_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,14 +449,20 @@ def gauge_information(self, max_length: int) -> float:
return float(estimates.gauge_information_estimate[max_length])

def predictability_gain(self, max_length: int) -> float:
"""Finite-block predictability gain ``PG(L) = h_mu(L) - h_mu`` (Bialek et al., 2001)."""
"""Excess ``PG(L) = h_mu(L) - h_mu`` of the length-``L`` entropy-rate estimate over the entropy rate.

This is the discrete learning curve :math:`\\Lambda(N)` of Bialek, Nemenman & Tishby
:cite:`bialek2001predictability` and the per-symbol redundancy :math:`r(L)` of Crutchfield & Feldman
:cite:`CrutchfieldFeldman2003` (their eq. 35). Crutchfield & Feldman reserve "predictability gain" for the
first difference :math:`\\Delta^2 H(L) = h_\\mu(L) - h_\\mu(L - 1)` (their eq. 36); the method keeps its name.
"""
if max_length < 1:
raise ValueError("max_length must be at least 1 for predictability gain")
estimates = self.block_entropy_estimates(max_length)
return float(estimates.predictability_gain_estimate[max_length])

def structural_information(self) -> float:
"""Asymptotic structural information (Feldman & Crutchfield, 1998)."""
"""Asymptotic structural information (Feldman & Crutchfield, 2003)."""
from sofic.generators.alternative_complexity import structural_information

return structural_information(self)
Expand Down
5 changes: 3 additions & 2 deletions sofic/generators/generative_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,9 @@ def generative_model_from_bidirectional(
"""Run the generator-search pipeline on an existing bidirectional machine; see the module docstring.

``global_bound`` (needs PySCIPOpt, ``pip install sofic[global]``) adds the restricted global bound for
generators with at most ``global_bound_states`` states (default :math:`\\min(|S^+|, |S^-|) + 1`), reported as
``restricted_lower``; see :class:`GenerativeModelResult`.
generators with at most ``global_bound_states`` states, reported as ``restricted_lower``; see
:class:`GenerativeModelResult`. The default, :math:`\\min(|S^+|, |S^-|) + 1`, is a convention, not a bound:
minimal generators can need more states.
"""
return _bracket_search(
bidir,
Expand Down
Loading
Loading