Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Mastering Probabilistic Graphical Models with Python
Mastering Probabilistic Graphical Models with Python

Mastering Probabilistic Graphical Models with Python: Master probabilistic graphical models by learning through real-world problems and illustrative code examples in Python

eBook
$35.99 $39.99
Paperback
$39.19 $48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Mastering Probabilistic Graphical Models with Python

Chapter 2. Markov Network Fundamentals

In the previous chapter, we saw how we can represent a joint probability distribution (JPD) using a directed graph and a set of conditional probability distributions (CPDs). However, it's not always possible to capture the independencies of a distribution using a Bayesian model. In this chapter, we will introduce undirected models, also known as Markov networks. We generally use Markov networks when we can't naturally define directionality in the interaction between random variables.

In this chapter, we will cover:

  • The basics of factors and their operations
  • The Markov model and Gibbs distribution
  • The factor graph
  • Independencies in the Markov model
  • Conversion of the Bayesian model to the Markov model and vice versa
  • Chordal graphs and triangulation heuristics

Introducing the Markov network

Let's take an example of four people who go out for dinner in different groups of two. A goes out with B, B goes out with C, C with D, and D with A. Due to some reasons (maybe due to a bad relationship), B doesn't want to go with D, and the same holds true for A and C. Let's think about the probability of them ordering food of the same cuisine. From our social experience, we know that people interacting with each other may influence each other's choice of food. In general, we can say that if A influences B's choice and B influences C's, then A might (as it is probabilistic) indirectly be influencing C's choice. However, given B's and D's choices, we can say with confidence that A won't affect C's choice of food. Formally, we can put this as Introducing the Markov network. Similarly, Introducing the Markov network as there is no direct interaction between A and C nor between B and D.

Let's try to model these independencies using a Bayesian network:

Introducing the Markov network

In the preceding...

The factor graph

The Markov network doesn't give a very clear picture of the Gibbs parameterization of the distribution because we can't conclude whether the factors in it involve the maximal cliques or subgraphs. To overcome this limitation of the Markov network, we require a representation that can show the parameterization explicitly. The factor graph is one such representation.

A factor graph is a bipartite graph, one disjoint set being variable nodes, representing the variables, and the other being factor nodes, representing factors. An edge between a variable node and a factor node denotes that the random variable belongs to the scope of the factor. Thus, a factor graph is parameterized by a set of factors, where each of them is associated with a factor node, whose scope is all sets of all the random variables that it is neighbor to.

Generally, all the variable nodes are represented by a circle and all the factor nodes are represented by a square. Here's an example:

The factor graph

Fig...

Independencies in Markov networks

In the previous chapter, we saw how a Bayesian network structure encodes independency conditions in it, and how observing variables affects the flow of influence in the network. Similarly, in the case of Markov networks, the graph structure encodes independency conditions. However, the flow of influence in a Markov network stops as soon as any node is observed in that trail. This is quite different from what we saw in the Bayesian network, where different structures responded differently to the observation of the nodes.

To understand this more formally, let H be a Markov network structure and Independencies in Markov networks be a set of observed variables. Then, the path Independencies in Markov networks is active if and only if none of the Independencies in Markov networks for Independencies in Markov networks are in Z.

In the case of Bayesian networks, we had the concept of local independencies, where a variable is independent of all its non-descendants, given given its parents. We also had global conditions which were implied by D-Separation. Similarly, in the case of Markov networks...

Constructing graphs from distributions

To construct a Markov network from a distribution, the mere concept of I-Maps is not enough. As in the case of Bayesian networks, a fully connected graph has no independence conditions and, hence, it can be an I-Map of any probability distribution. Therefore, we introduce the concept of the minimal I-Map in Markov networks as well. To construct a minimal I-Map, we can use the local independency conditions that we defined in the previous section.

In the first approach, let's consider the case of pairwise independencies. According to pairwise independencies, if there is no edge between {X, Y}, then Constructing graphs from distributions. Thus, at the very least, to guarantee that H is an I-map, we must add direct edges between all pairs of nodes X and Y, such that they are dependent even on observing all the other variables in the network.

Similarly, we can get more information about the structure by using the local independencies conditions. For each variable X, we can find the minimal...

Bayesian and Markov networks

Until now, we have discussed two different models for representing graphical models. Each of these can represent independence constraints that the other cannot. In this section, we will look at the relationship between these two models.

Converting Bayesian models into Markov models

Both Bayesian models and Markov models parameterize a probability distribution using a graphical model. Further, these structures also encode the independencies among the random variable. So, when converting a Bayesian model into a Markov one, we have to look from the following two perspectives:

  • From the perspective of parameterization, that is, representing the probability distribution of the Bayesian model Converting Bayesian models into Markov models using a fully parameterized Markov model
  • From the perspective of independencies, that is, representing the independence constraints encoded by the Bayesian model using the Markov model

From the first perspective, conversion of the Bayesian model into the Markov model is fairly simple...

Introducing the Markov network


Let's take an example of four people who go out for dinner in different groups of two. A goes out with B, B goes out with C, C with D, and D with A. Due to some reasons (maybe due to a bad relationship), B doesn't want to go with D, and the same holds true for A and C. Let's think about the probability of them ordering food of the same cuisine. From our social experience, we know that people interacting with each other may influence each other's choice of food. In general, we can say that if A influences B's choice and B influences C's, then A might (as it is probabilistic) indirectly be influencing C's choice. However, given B's and D's choices, we can say with confidence that A won't affect C's choice of food. Formally, we can put this as . Similarly, as there is no direct interaction between A and C nor between B and D.

Let's try to model these independencies using a Bayesian network:

In the preceding figure, the one labeled Fig 2.1(a) is the Bayesian network...

Left arrow icon Right arrow icon

Description

Probabilistic Graphical Models is a technique in machine learning that uses the concepts of graph theory to compactly represent and optimally predict values in our data problems. In real world problems, it's often difficult to select the appropriate graphical model as well as the appropriate inference algorithm, which can make a huge difference in computation time and accuracy. Thus, it is crucial to know the working details of these algorithms. This book starts with the basics of probability theory and graph theory, then goes on to discuss various models and inference algorithms. All the different types of models are discussed along with code examples to create and modify them, and also to run different inference algorithms on them. There is a complete chapter devoted to the most widely used networks Naive Bayes Model and Hidden Markov Models (HMMs). These models have been thoroughly discussed using real-world examples.

Who is this book for?

If you are a researcher or a machine learning enthusiast, or are working in the data science field and have a basic idea of Bayesian learning or probabilistic graphical models, this book will help you to understand the details of graphical models and use them in your data science problems.

What you will learn

  • Get to know the basics of probability theory and graph theory
  • Work with Markov networks
  • Implement Bayesian networks
  • Exact inference techniques in graphical models such as the variable elimination algorithm
  • Understand approximate inference techniques in graphical models such as message passing algorithms
  • Sampling algorithms in graphical models
  • Grasp details of Naive Bayes with realworld examples
  • Deploy probabilistic graphical models using various libraries in Python
  • Gain working details of Hidden Markov models with realworld examples
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 03, 2015
Length: 284 pages
Edition : 1st
Language : English
ISBN-13 : 9781784394684
Category :
Languages :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Aug 03, 2015
Length: 284 pages
Edition : 1st
Language : English
ISBN-13 : 9781784394684
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 78.38 97.98 19.60 saved
Mastering Probabilistic Graphical Models with Python
$39.19 $48.99
Python Machine Learning
$39.19 $48.99
Total $ 78.38 97.98 19.60 saved Stars icon

Table of Contents

8 Chapters
1. Bayesian Network Fundamentals Chevron down icon Chevron up icon
2. Markov Network Fundamentals Chevron down icon Chevron up icon
3. Inference – Asking Questions to Models Chevron down icon Chevron up icon
4. Approximate Inference Chevron down icon Chevron up icon
5. Model Learning – Parameter Estimation in Bayesian Networks Chevron down icon Chevron up icon
6. Model Learning – Parameter Estimation in Markov Networks Chevron down icon Chevron up icon
7. Specialized Models Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.3
(7 Ratings)
5 star 42.9%
4 star 0%
3 star 28.6%
2 star 0%
1 star 28.6%
Filter icon Filter
Top Reviews

Filter reviews by




AlfredO Apr 22, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The subject is covered well and with lots of code examples. I found it very readable even though this was my first contact with PGM
Amazon Verified review Amazon
rdasxy Oct 05, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I bought this book while still parallelly working through Daphne Koller's Probabilistic Graphical Models course and textbook, and it was a great resource in helping me understand and apply the concepts using python.Highly recommended!
Amazon Verified review Amazon
Ashish K. Oct 30, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I thoroughly enjoyed this book.. its lucid and to-the-point writing really drives home the concepts.I say its a must-have book.great job guys.. No wonder u are from the best engineering college in India..
Amazon Verified review Amazon
Anhnhat Tran Apr 26, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
The main content of this book is based on the following book "Probabilistic Graphical Models: Principles and Techniques". In multiple places, we can see that this book just summarizes or follows strictly the main points of the above book. The plus side of this book is that it provides more examples, which may help readers understand more deeply about the subject. There are a few typos, which makes it difficult to read. This book can be a good supplement for the above book but can hardly stand on its own, due to lacking of originality.
Amazon Verified review Amazon
Roest Sep 23, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
What is nice about this book is that it is based on an open source Python library that implements the concepts. Also, it provides a somewhat comprehensive overview of Bayesian and Markov network theory. The downside is that the code fragments in the book are just wrong on more than one occasion, numerical results that are presented are sometimes wrong and more than once, the code fragments are just besides the point. The explanation of the concepts is not the best and the extremely bad layout of formulas in the e-book doesn’t help. So, in summary: nice if you want to try the Python library, but not really brilliant.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon