Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marginal distribution in simulated data doesn't match specified virtual evidence #1789

Open
ankurankan opened this issue Jun 21, 2024 · 0 comments
Labels

Comments

@ankurankan
Copy link
Member

In the example below the specified virtual evidence for CVP doesn't match the marginal distribution when computed from the samples.

>>> from pgmpy.factors.discrete import TabularCPD
>>> from pgmpy.utils import get_example_model

>>> alarm = get_example_model("alarm")
>>> cvp_evidence = TabularCPD(variable="CVP",
                          variable_card=3,
                          values=[[0.2], [0.3], [0.5]],
                          state_names={"CVP": ["LOW", "NORMAL", "HIGH"]})
>>> samples = alarm.simulate(n_samples=int(1e4), virtual_evidence=[cvp_evidence])

>>> samples.groupby(['CVP']).size() / samples.shape[0]
CVP
HIGH      0.2444
LOW       0.0736
NORMAL    0.6820
dtype: float64
@ankurankan ankurankan added the Bug label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant