Embedded Systems Tutorial

Artificial Intelligence

Machine Learning

Machine Learning with Java

ML & AI Practice

PGMs and Neural Network Example: The Boyfriend Problem

In this tutorial, we will learn how PGMS and Neural Network are used to solve a problem and also to know which is the best algorithm which is easy to use and to solve a problem? By Bharti Parmar Last updated : April 17, 2023

PGM and Neural Network

Both are capable for inferencing and learning problem.

Difference: To get prior knowledge in the existing model. Like: we can constraint a PGM what can Neural network does and torcher a neural network to get some information PGM would naturally give you.

The Boyfriend Problem

Here, we use both the algorithms and we see which is the more beneficial algorithm, for us to find a correct and solution of any problem easily in less time.

First we see what exactly a boyfriend problem is?

the boyfriend problem image 1


A girl like a guy that she knows through end no. of mutual friend and she want to ask him for a date. Now, she wants some guy who can boost her to him. Then,

  • If any friend who is close to him and if he put some good words for her then it will have a strong positive influence.
  • If someone says bad things about her to him then, he will not talk to her. Suppose, there are 'n' No. of friends then 'N' bit vector = {0,1,0,1,0,1……} is a boost where, 0 means No contact and 1 for contact.

Now, here we use both the algorithms to solve this problem:


Find the set of friends that she should ask to boost him that is a best vector.

Solution of the Boyfriend Problem using Neural Network

Consider the below graph –

the boyfriend problem image 2

Now, if we take 3 top close friend in observation the chances is more to get accepted her proposal.

So, somehow she has to manage to do that then, neural network can act as an oracle.

Individually it will not give us a prediction, so, here we use neural network.

Solution of the Boyfriend Problem using PGMs

Consider the below graph –

the boyfriend problem image 3

In this 'N' No. of friends give her an approval to get accepter or rejecter (it will leave her for an impression) it is called random variable.

P(impression / vector of all approval) ← P(approval from friend / impression)

P(all approval / impression) = product of all P (approval / impression)

So, this is very simple and best to solve this problem.


In this tutorial, we have learnt that how PGMs and neural network are solving any problem and which is best to use by using boyfriend problem? We will know more about ML in the upcoming articles. Have a Nice day! Happy Learning!

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.