Replies: 3 comments 4 replies
-
@jonasvit I am not sure what this formula might look like. Could you maybe give an example? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Of course. Here is an example: We can plot our models but it would be also nice to see the formulas, how we estimate probability for a nod. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@jonasvit Since the formula is essentially the product of each conditional probability distribution (CPD), and the CPDs are defined as P(var | parents), we can write something like this to get the formula: In [7]: from pgmpy.models import BayesianNetwork
In [8]: model = BayesianNetwork([('A', 'C'), ('B', 'C')])
In [9]: ''.join([f"P({var}|{', '.join(model.get_parents(var))})" for var in model.nodes()])
Out[9]: 'P(A|)P(C|A, B)P(B|)' |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I wonder if there is a way to get the mathematical formula from the already built Bayesian network with pgmpy? It would be really nice when we have more complex models (not naive) and there is a need to explain final results or calculate results ourselves to check the answer.
Beta Was this translation helpful? Give feedback.
All reactions