Repository navigation
feat: add entropic regression for equation discovery (#8) - #61
Open
ParitKansal wants to merge 1 commit into
Open
ParitKansal wants to merge 1 commit into
ParitKansal wants to merge 1 commit into
Conversation
…stems-Science#8) New module causationentropy.core.estimators with EntropicRegression, entropic_regression, polynomial_library and central_difference, following AlMomani, Sun and Bollt (Chaos 30, 013107, 2020): greedy forward selection and backward elimination of basis functions scored by the conditional mutual information of their least-squares model output, with shuffle tests. The k-NN estimator uses the Chebyshev metric in every step. Adds tests, an API docs page and a changelog entry.
ParitKansal
force-pushed
the
feature/entropic-regression
branch
from
October 23, 2026 05:39
2d8ca47 to
3e7ee38
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #8 (equation discovery).
Summary
Adds entropic regression (ER), from AlMomani, Sun and Bollt, "How entropic regression beats the outliers problem in nonlinear system identification", Chaos 30, 013107 (2020), arXiv:1905.08061. ER finds a sparse equation for each state variable in a library of basis functions. It uses the same forward selection and backward elimination as oCSE, but scores each candidate term by the conditional mutual information of its least-squares model output.
New module
causationentropy/core/estimators.py:EntropicRegressionfit(X, dt=...)orfit(X, X_dot=...), thenequations(),predict(),coef_,support_entropic_regression(f, Phi)polynomial_library(X, degree)central_difference(X, dt)The code reuses the library's
conditional_mutual_information(defaultinformation="knn", k = 2 as in the paper) andshuffle_test. It was written from the paper only; no code from the GPL-licensed ERFit MATLAB package was used.Design choices (documented in the docstrings)
fit_intercept=Trueinstead.fexactly, the CMI is set to 0 (its true value). Without this, the k-NN estimate on nearly identical vectors is positive and terms with zero coefficients get selected on exact data.information="knn", the metric defaults to Chebyshev in every step. In the current library,knn_conditional_mutual_informationuses Minkowski whenZ is Noneand Chebyshev otherwise (fixed by fix: break ties in the k-NN estimators and use Chebyshev when Z is None (follow-up to #14) #53); without this default, the first ER step would use a different metric from the later ones.Checks
tests/core/test_estimators.py, 17 tests + 3 doctests)X_dot= next state)test_data_integration.pyfail the same way on thesymbolic-cmi-estimatorbranch, andtest_standard_knnalso fails onmain; this PR does not touchdiscover_networkor the estimators those tests usesphinx-build)mainand on this branch)Independent re-implementation
A separate session, given only the ER paper (no access to this code), re-implemented ER, wrote its own tests, and froze its code with SHA-256 hashes. Then it compared both versions on identical inputs:
Notes for review