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

Error with python package pgmpy # #395

Open
myrasika opened this issue Jan 5, 2024 · 0 comments
Open

Error with python package pgmpy # #395

myrasika opened this issue Jan 5, 2024 · 0 comments

Comments

@myrasika
Copy link

myrasika commented Jan 5, 2024

I'm running into error using pgmpy doing calculations for conditional probability (bayesian network)

This is the structure of the network.
weather_chart = BayesianModel([('Weather', 'Temperature'),
('Weather', 'Wind'),
('Weather', 'Rain'),
('Temperature', 'Bring_Jacket'),
('Wind', 'Bring_Jacket'),
('Rain', 'Bring_Jacket'),
('Temperature', 'Bring_Umbrella'),
('Wind', 'Bring_Umbrella'),
('Rain', 'Bring_Umbrella')])

The error I get is when running : model.check_model()

The error I get:
ValueError Traceback (most recent call last)
in
1 # Check model for correctness
----> 2 weather_chart.check_model()

~/Library/Python/3.9/lib/python/site-packages/pgmpy/models/BayesianNetwork.py in check_model(self)
427 # Check if the values of the CPD sum to 1.
428 if not cpd.is_valid_cpd():
--> 429 raise ValueError(
430 f"Sum or integral of conditional probabilities for node {node} is not equal to 1."
431 )

ValueError: Sum or integral of conditional probabilities for node Temperature is not equal to 1.

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

No branches or pull requests

1 participant