Created
January 15, 2019 15:33
-
-
Save Octogonapus/f4033f575c878fece819306c64fc75b6 to your computer and use it in GitHub Desktop.
A test to generate CPD's and do random variable inference using pgmpy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option CPD: | |
+----------+-----+ | |
| option_0 | 0.3 | | |
+----------+-----+ | |
| option_1 | 0.7 | | |
+----------+-----+ | |
Jaywalking CPD: | |
+--------------+----------+----------+ | |
| option | option_0 | option_1 | | |
+--------------+----------+----------+ | |
| jaywalking_0 | 0.6 | 0.4 | | |
+--------------+----------+----------+ | |
| jaywalking_1 | 0.4 | 0.6 | | |
+--------------+----------+----------+ | |
Jaywalking inference: | |
+--------------+-------------------+ | |
| jaywalking | phi(jaywalking) | | |
+==============+===================+ | |
| jaywalking_0 | 0.4600 | | |
+--------------+-------------------+ | |
| jaywalking_1 | 0.5400 | | |
+--------------+-------------------+ | |
Jaywalking inference given option=1: | |
+--------------+-------------------+ | |
| jaywalking | phi(jaywalking) | | |
+==============+===================+ | |
| jaywalking_0 | 0.4000 | | |
+--------------+-------------------+ | |
| jaywalking_1 | 0.6000 | | |
+--------------+-------------------+ | |
Most probable states for: | |
Option: {'option': 1} | |
Jaywalking: {'jaywalking': 1} | |
Jaywalking given option=0: {'jaywalking': 0} | |
Jaywalking given option=1: {'jaywalking': 1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment