mixle.experimental.equation_discovery module

P8 (experimental) – the closed-loop scientist: equation discovery with an exact referee.

The integrative “AI scientist” loop, made honest and gradeable: an agent probes a world by choosing where to observe its dynamics, fits a sparse combination of candidate operator terms (SINDy-style sequentially-thresholded least squares – symbolic regression over a term library), and is graded against the actual governing operator: recovered-form match and coefficient error versus experiment budget.

Because the true operator is known, discovery can be scored exactly – the property the card prizes (“the referee is exact”). And because identifying a high-order term (e.g. a cubic) needs high-leverage observations at the extremes of state space, choosing the experiments beats random probing at a fixed budget.

Scope: this is the in-repo, self-contained core on scalar dynamical-system worlds (dx/dt = f(x)). The full P8 flagship runs this loop inside the mixle-pde PDE worlds (linear diffusion -> advection-diffusion -> Burgers) over the register_dynamics_operator grammar; that lives in the mixle-pde companion (Track N), not this repo.

Exploratory mixle.experimental code (P8 card).

library_matrix(x)[source]

Design matrix of candidate operator terms [1, x, x^2, x^3].

Parameters:

x (ndarray)

Return type:

ndarray

observe(x, true_coef, *, noise, rng)[source]

Measure the dynamics dx/dt = f(x) + noise at the probe points x.

Parameters:
Return type:

ndarray

stlsq(design, y, *, threshold, iters=12)[source]

Sequentially-thresholded least squares (the SINDy sparse-regression operator).

Parameters:
Return type:

ndarray

recovered_form(coef, *, tol=1e-6)[source]

The set of active term indices – the recovered symbolic form.

Parameters:
Return type:

frozenset[int]

active_experiments(budget, radius)[source]

High-leverage probe placement: Chebyshev-like nodes spanning the extremes of state space.

Parameters:
Return type:

ndarray

random_experiments(budget, radius, rng)[source]

Passive baseline: probe points drawn uniformly over the state range.

Parameters:
Return type:

ndarray

class DiscoveryReceipt(recovered_coef: 'np.ndarray', recovered_terms: 'frozenset[int]', true_terms: 'frozenset[int]', form_match: 'bool', coef_error: 'float', spurious_terms: 'frozenset[int]', missing_terms: 'frozenset[int]')[source]

Bases: object

Parameters:
discover(true_coef, probes, *, noise, threshold, seed)[source]

Run one discovery experiment: observe at probes, recover the operator, grade exactly.

Parameters:
Return type:

DiscoveryReceipt

discovery_rate(true_coef, *, strategy, budget, radius, noise, threshold, seeds)[source]

Fraction of seeds on which strategy recovers the exact operator form at the given budget.

Parameters:
Return type:

float