Skip to content

fix: restore Poisson CMI sign (follow-up to #42) - #51

Open
Parva-26 wants to merge 1 commit into
Center-For-Complex-Systems-Science:mainfrom
Parva-26:fix/poisson-cmi-sign
Open

Parva-26 wants to merge 1 commit into
Center-For-Complex-Systems-Science:mainfrom
Parva-26:fix/poisson-cmi-sign

Conversation

@Parva-26

@Parva-26 Parva-26 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #42, as discussed in that thread.

Problem

#42 changed the last line of poisson_conditional_mutual_information to cmi = H_YZ - H_XYZ. H_YZ and H_XYZ are differences of poisson_joint_entropy terms built from the adjusted matrix SS, not plain conditional entropies, so with that sign the raw CMI is negative for dependent data. The wrapper clamps it to 0 and Poisson discovery finds no edges.

Changes

  • Restore cmi = H_XYZ - H_YZ (the order used by Compute_CMI_Poisson in jefish003/NetworkInference) and replace the inline comment that suggested the opposite. The np.ix_ indexing from fix: kde_entropy numerical stability, np.matrix removal, Poisson CMI sign #42 is kept.
  • test_poisson_cmi_via_main_function: compare the wrapper with max(0.0, direct). X, Y and Z are independent in that test, so the raw value can be slightly negative and the wrapper clamps it. The test only passed before because of the old indexing offset and then because of the flipped sign.
  • test_poisson_cmi_count_data_properties: also check that the conditional estimate is positive (it is -0.66 on current main).
  • New test_poisson_cmi_sign_dependent_vs_independent: over 20 datasets, the raw CMI is positive on every dependent dataset (mean > 0.2) and its mean is close to 0 on independent data.
  • New causationentropy/tests/test_poisson_discovery.py: a ~4 second standard oCSE run with information="poisson" on poisson_coupled_oscillators, so the Poisson path is covered by the default suite. The existing Poisson integration tests are deselected by default, which is why fix: kde_entropy numerical stability, np.matrix removal, Poisson CMI sign #42 passed CI.

Validation

Not included: the SS = SXYZ aliasing and fill_diagonal questions that @jefish003 is looking into.

This branch has not been deployed

No deployments
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.

1 participant