Skip to content

Move methods in cinnabar.stats concerning MLE to the MLEEstimator class#211

Open
ianmkenney wants to merge 10 commits into
mainfrom
feat/remove_stats_mle
Open

Move methods in cinnabar.stats concerning MLE to the MLEEstimator class#211
ianmkenney wants to merge 10 commits into
mainfrom
feat/remove_stats_mle

Conversation

@ianmkenney

Copy link
Copy Markdown
Member

No description provided.

@ianmkenney

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.24%. Comparing base (8282134) to head (bd901c7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #211   +/-   ##
=======================================
  Coverage   97.23%   97.24%           
=======================================
  Files          22       22           
  Lines        2027     2032    +5     
=======================================
+ Hits         1971     1976    +5     
  Misses         56       56           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ianmkenney

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@ianmkenney ianmkenney requested a review from jthorton May 27, 2026 15:35
@ianmkenney ianmkenney changed the title [DNM] Move methods in cinnabar.stats concerning MLE to the MLEEstimator class Move methods in cinnabar.stats concerning MLE to the MLEEstimator class May 27, 2026
Comment thread cinnabar/estimators.py
)

@staticmethod
def mle(graph: nx.DiGraph, factor: str = "f_ij", node_factor: Union[str, None] = None) -> (np.ndarray, np.ndarray):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are free to change this however we want, lets update the factor and node_factor names to be more meaningful or if you think its okay we can leave them.

Comment thread cinnabar/estimators.py
# populate the edges of the graph along with their computational binding free energies
for m in filter(lambda m: m.computational, measurements):
if isinstance(m.labelA, ReferenceState):
# TODO this is never hit in the tests and should be supported behavior

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point lets move this to another PR we should be able to support absolute computational values in the solver as well!

Comment thread cinnabar/estimators.py
Comment on lines +355 to +361
z[i] += -deltaij / varij
z[j] += deltaij / varij

F_matrix[i, i] += 1 / varij
F_matrix[j, j] += 1 / varij
F_matrix[i, j] += -1 / varij
F_matrix[j, i] += -1 / varij

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice this should allow for the forward and backward results do you want to add support for that in this PR? We have some example data in #133 so we can add a test we can punt to another if you want though.

Comment thread cinnabar/estimators.py
return f_i, Finv

@staticmethod
def form_edge_matrix(graph: nx.Graph, label: str, step=None, action=None, node_label=None) -> np.ndarray:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets just remove this if its not needed anymore and all tests associated with it!

@jthorton jthorton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great just a couple of things to look at.

@jthorton jthorton self-assigned this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants