-
Book Overview & Buying
-
Table Of Contents
Mastering Probabilistic Graphical Models with Python
By :
Let's now see some coding examples using pgmpy, to represent joint distributions and independencies. Here, we will mostly work with IPython and pgmpy (and a few other libraries) for coding examples. So, before moving ahead, let's get a basic introduction to these.
IPython is a command shell for interactive computing in multiple programming languages, originally developed for the Python programming language, which offers enhanced introspection, rich media, additional shell syntax, tab completion, and a rich history. IPython provides the following features:
You can install IPython using the following command:
>>> pip3 install ipython
To start the IPython command shell, you can simply type ipython3 in the terminal. For more installation instructions, you can visit http://ipython.org/install.html.
pgmpy is a Python library to work with Probabilistic Graphical models. As it's currently not on PyPi, we will need to build it manually. You can get the source code from the Git repository using the following command:
>>> git clone https://github.com/pgmpy/pgmpy
Now cd into the cloned directory switch branch for version used in this book and build it with the following code:
>>> cd pgmpy >>> git checkout book/v0.1 >>> sudo python3 setup.py install
For more installation instructions, you can visit http://pgmpy.org/install.html.
With both IPython and pgmpy installed, you should now be able to run the examples in the book.
Change the font size
Change margin width
Change background colour