0% found this document useful (0 votes)
147 views30 pages

ML Assignment Week 4 2019 Nptel

ML ASSIGNMENT SOLUTIONS

Uploaded by

Ashok Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views30 pages

ML Assignment Week 4 2019 Nptel

ML ASSIGNMENT SOLUTIONS

Uploaded by

Ashok Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Introduction to Machine Learning

Assignment- Week 4
TYPE OF QUESTION: MCQ
Number of questions: 7 Total mark: 7 X 2 = 14
______________________________________________________________________________

QUESTION 1:
A spam filtering system has a probability of 0.95 to correctly classify a mail as spam and 0.10
probability of giving false positives. It is estimated that 1% of the mails are actual spam mails.
Suppose that the system is now given a new mail to be classified as spam/ not-spam, what is the
probability that the mail will be classified as spam?
A. 0.89575
B. 0.10425
C. 0.1085
D. 0.0995

Correct Answer: C. 0.1085

Detailed Solution:

Let S = ‘Mails correctly marked spam by the system’, T= ‘Mails misclassified by the
system’(Marked as spam when not spam or Marked as not spam when it is a spam) , M=
‘Spam mails’.

P(S|M)= 0.95 , P(S|M’) = 0.10 , P(M) = 0.01

We have to find the probability of mail being classified as spam which can either be if a spam
mail is correctly classified as spam or if a mail is misclassified as spam.

𝑃(𝑆) = 𝑃(𝑆|𝑀) * 𝑃(𝑀) + 𝑃(𝑆|𝑀') * 𝑃(𝑀') = 0. 95 * 0. 01 + 0. 10 * 0. 99 = 0. 1085

______________________________________________________________________________

QUESTION 2:
Bag I contains 4 white and 6 black balls while another Bag II contains 4 white and 3 black balls.
One ball is drawn at random from one of the bags and it is found to be black. Find the probability
that it was drawn from Bag I.
A. 1/2
B. 2/3
C. 7/12
D. 9/23

Correct Answer : C. 7/12

Detailed Solution :

B1: “Ball is drawn from bag I”, B2: “Ball is drawn from bag II”, W: “Drawn ball is white”,
B: “Drawn ball is black”

We have to find 𝑃(𝐵1|𝐵)


𝑃(𝐵|𝐵1)*𝑃(𝐵1) (6/10)*(1/2) 3/10 7
𝑃(𝐵1|𝐵) = 𝑃(𝐵|𝐵1)*𝑃(𝐵1)+𝑃(𝐵|𝐵2)*𝑃(𝐵2)
= (6/10)*(1/2)+(3/7)*(1/2)
= 3/10+3/14
= 12

______________________________________________________________________________

QUESTION 3:
4. Consider the following Bayesian network, where F = having the flu and C = coughing:

Find P(C) and P(F|C).

A. 0.35, 0.23
B. 0.35,0.77
C. 0.24, 0.024
D. 0.5, 0.23

Correct Answer: A. 0.35, 0.23

Detailed Solution :

𝑃(𝐶) = 𝑃(𝐶|𝐹) * 𝑃(𝐹) + 𝑃(𝐶|𝐹) * 𝑃(𝐹)


𝑃(𝐶|𝐹)*𝑃(𝐹)
𝑃(𝐹|𝐶) =
𝑃(𝐶|𝐹)*𝑃(𝐹)+𝑃(𝐶|𝐹)*𝑃(𝐹)

______________________________________________________________________________

QUESTION 4:
Consider the following Bayesian network.
Thus, the independence expressed in this Bayesian net are that
A and B are (absolutely) independent.
C is independent of B given A.
D is independent of C given A and B.
E is independent of A, B, and D given C.

Suppose that the net further records the following probabilities:


𝑃(𝐴) = 0. 3
𝑃(𝐵) = 0. 6
𝑃(𝐶|𝐴) = 0. 8
𝑃(𝐶|𝐴) = 0. 4
𝑃(𝐷|𝐴, 𝐵) = 0. 7
𝑃(𝐷|𝐴, 𝐵) = 0. 8
𝑃(𝐷|𝐴, 𝐵) = 0. 1
𝑃(𝐷|𝐴, 𝐵) = 0. 2
𝑃(𝐸|𝐶) = 0. 7
𝑃(𝐸|𝐶) = 0. 7

Find 𝑃(𝐷).
A. 0.32
B. 0.50
C. 0.40
D. 0.78
Correct Answer: A. 0.32

Detailed Solution :
𝑃(𝐷) = 𝑃(𝐷|𝐴𝐵) * 𝑃(𝐴𝐵) + 𝑃(𝐷|𝐴𝐵) * 𝑃(𝐴𝐵) + 𝑃(𝐷|𝐴𝐵) * 𝑃(𝐴𝐵) + 𝑃(𝐷|𝐴 𝐵) * 𝑃(𝐴 𝐵) = 0. 32

____________________________________________________________________________
QUESTION 5:
Consider the following graphical model, mark which of the following pair of random variables
are independent given no evidence?

A. a,b
B. c,d
C. e,d
D. c,e
Correct Answer : A. a,b

Detailed Solution : Nodes a and b don’t have any predecessor nodes. As they don’t have any
common parent node, a and b are independent.

_____________________________________________________________________________

QUESTION 6:
In a Bayesian network a node with only outgoing edge(s) represents

A. a variable conditionally independent of the other variables.


B. a variable dependent on its siblings.
C. a variable whose dependency is uncertain.
D. None of the above.

Correct Answer: A. a variable conditionally independent of the other variables.

Detailed Solution : As there is no incoming edge for the node, the node is not conditionally
dependent on any other node.
______________________________________________________________________________

QUESTION 7:
It is given that 𝑃(𝐴|𝐵) = 2/3 and 𝑃(𝐴|𝐵) = 1/3. Compute the value of 𝑃(𝐵|𝐴).
A. ½
B. ⅔
C. ¾
D. Not enough information.
Correct Solution : D. Not enough information.
Detailed Solution : There are 3 unknown probabilities 𝑃(𝐴), 𝑃(𝐵), 𝑃(𝐴𝐵)which can not be
computed from the 2 given probabilities. So, we don’t have enough information to compute
𝑃(𝐵|𝐴).
______________________________________________________________________________

************END*******
Introduction to Machine Learning
Assignment- Week 4
TYPE OF QUESTION: MCQ
Number of questions: 10 Total mark: 10 X 2 = 20
______________________________________________________________________________

QUESTION 1:
A man is known to speak the truth 2 out of 3 times. He throws a die and reports that the number
obtained is 4. Find the probability that the number obtained is actually 4 :
A. 2/3
B. 3/4
C. 5/22
D. 2/7

Correct Answer : D. 2/7


Detailed Solution : Suppose,

𝐴 : 𝑇ℎ𝑒 𝑚𝑎𝑛 𝑟𝑒𝑝𝑜𝑟𝑡𝑠 𝑡ℎ𝑎𝑡 4 𝑖𝑠 𝑜𝑏𝑡𝑎𝑖𝑛𝑒𝑑.


𝐵 : 𝑁𝑢𝑚𝑏𝑒𝑟 4 𝑖𝑠 𝑜𝑏𝑡𝑎𝑖𝑛𝑒𝑑
𝑃(𝐴|𝐵)𝑃(𝐵) 2 1 1 5
𝑃(𝐵|𝐴) = here, 𝑃(𝐴|𝐵) = 3
, 𝑃(𝐵) = 6
, 𝑃(𝐴|𝐵) = 3
, 𝑃(𝐵) = 6
𝑃(𝐴|𝐵)𝑃(𝐵)+𝑃(𝐴|𝐵)𝑃(𝐵)

2
𝑃(𝐵|𝐴) = 7

_________________________________________________________________

QUESTION 2:
Consider the following graphical model, mark which of the following pair of random variables
are independent given no evidence?
A. a,b
B. c,d
C. e,d
D. c,e
Correct Answer : A. a,b

Detailed Solution : Nodes a and b don’t have any predecessor nodes. As they don’t have any
common parent nodes, a and b are independent.

______________________________________________________________________________

QUESTION 3:
Two cards are drawn at random from a deck of 52 cards without replacement. What is the
probability of drawing a 2 and an Ace in that order?
A. 4/51
B. 1/13
C. 4/256
D. 4/663

Correct Answer : D. 4/663

Detailed Solution :

A : Drawing a 2

B : Drawing an Ace from the remaining 51 cards


4 1 4
𝑃(𝐴𝐵) = 𝑃(𝐴) * 𝑃(𝐵|𝐴) here, 𝑃(𝐴) = 52
= 13
, 𝑃(𝐵|𝐴) = 51

1*4 4
𝑃(𝐴𝐵) = 13*51
= 663

______________________________________________________________________________
QUESTION 4:
Consider the following Bayesian network. The random variables given in the model are
modeled as discrete variables (Rain = R, Sprinkler = S and Wet Grass = W) and the
corresponding probability values are given below.

P(R) = 0.1
P(S) = 0.2
P(W | R, S) = 0.8
P(W | R, ¬ S) = 0.7
P(W | ¬ R, S) = 0.6
P(W | ¬ R, ¬ S) = 0.5

Calculate P(S | W, R).

A. 1
B. 0.5
C. 0.22
D. 0.78

Correct Answer : C. 0.22

𝑃(𝑊,𝑆,𝑅) 𝑃(𝑊𝑆𝑅)
Detailed Solution : 𝑃(𝑆|𝑊, 𝑅) = 𝑃(𝑊,𝑅)
=
𝑃(𝑊𝑆𝑅)+𝑃(𝑊𝑆𝑅)
𝑃(𝑊𝑆𝑅) = 𝑃(𝑊|𝑆, 𝑅) * 𝑃(𝑅) * 𝑃(𝑆) = 0. 8 * 0. 1 * 0. 2 = 0. 016
𝑃(𝑊𝑆𝑅) = 𝑃(𝑊|𝑆, 𝑅) * 𝑃(𝑅) * 𝑃(𝑆) = 0. 7 * 0. 1 * 0. 8 = 0. 056

____________________________________________________________________________
QUESTION 5:
What is the naive assumption in a Naive Bayes Classifier?

A. All the classes are independent of each other


B. All the features of a class are independent of each other
C. The most probable feature for a class is the most important feature to be considered for
classification
D. All the features of a class are conditionally dependent on each other.

Correct Answer: B. All the features of a class are independent of each other

Detailed Solution: Naive Bayes Assumption is that all the features of a class are independent of
each other which is not the case in real life. Because of this assumption, the classifier is called
Naive Bayes Classifier.

_____________________________________________________________________________

QUESTION 6:
A drug test (random variable T) has 1% false positives (i.e., 1% of those not taking drugs show
positive in the test), and 5% false negatives (i.e., 5% of those taking drugs test negative).
Suppose that 2% of those tested are taking drugs. Determine the probability that somebody who
tests positive is actually taking drugs (random variable D).
A. 0.66
B. 0.34
C. 0.50
D. 0.91

Correct Answer : A. 0.66


Detailed Solution :
𝑃(𝑇|𝐷)𝑃(𝐷) 95 1 2
𝑃(𝐷|𝑇) = , 𝑃(𝑇|𝐷) = 100
, 𝑃(𝑇|𝐷) = 100
, 𝑃(𝐷) = 100
𝑃(𝑇|𝐷)𝑃(𝐷)+𝑃(𝑇|𝐷)𝑃(𝐷)
𝑃(𝐷|𝑇) = 0. 66

______________________________________________________________________________
QUESTION 7:
It is given that 𝑃(𝐴|𝐵) = 2/3 and 𝑃(𝐴|𝐵) = 1/4. Compute the value of 𝑃(𝐵|𝐴).
A. ½
B. ⅔
C. ¾
D. Not enough information.
Correct Solution : D. Not enough information.
Detailed Solution : There are 3 unknown probabilities 𝑃(𝐴), 𝑃(𝐵), 𝑃(𝐴𝐵)which can not be
computed from the 2 given probabilities. So, we don’t have enough information to compute
𝑃(𝐵|𝐴).
______________________________________________________________________________

QUESTION 8:
Answer Questions 8-9 with the data given below:
A patient goes to a doctor with symptoms S1, S2 and S3. The doctor suspects disease D1and D2
and constructs a Bayesian network for the relation among the disease and symptoms as the
following:

What is the joint probability distribution in terms of conditional probabilities?


A. 𝑃(𝐷1) * 𝑃(𝐷2|𝐷1) * 𝑃(𝑆1|𝐷1) * 𝑃(𝑆2|𝐷1) * 𝑃(𝑆3|𝐷2)
B. 𝑃(𝐷1) * 𝑃(𝐷2) * 𝑃(𝑆1|𝐷1) * 𝑃(𝑆2|𝐷1) * 𝑃(𝑆3|𝐷1, 𝐷2)
C. 𝑃(𝐷1) * 𝑃(𝐷2) * 𝑃(𝑆1|𝐷2) * 𝑃(𝑆2|𝐷2) * 𝑃(𝑆3|𝐷2)
D. 𝑃(𝐷1) * 𝑃(𝐷2) * 𝑃(𝑆1|𝐷1) * 𝑃(𝑆2|𝐷1, 𝐷2) * 𝑃(𝑆3|𝐷2)

Correct Answer: D.
Detailed Solution: From the figure, we can see that D1 and D2 are not dependent on any
variable as they don’t have any incoming directed edges. S1 has an incoming edge from D1,
hence S1 depends on D1. S2 has 2 incoming edges from D1 and D2, hence S2 depends on D1
and D2. S3 has an incoming edge from D2, S3 depends on D2. Hence, (D) is the answer.

______________________________________________________________________________

QUESTION 9:
Suppose P(D1) = 0.5, P(D2)=0.6 , P(S1|D1)=0.4 and P(S1| D1’ )= 0.6. Find P(S1)
A. 0.14
B. 0.36
C. 0.50
D. 0.66

Correct Answer: C. 0.50

Detailed Solution:

𝑃(𝑆1) = 𝑃(𝑆1|𝐷1) * 𝑃(𝐷1) + 𝑃(𝑆1|𝐷1')𝑃(𝐷1') = 0. 4 * 0. 5 + 0. 6 * 0. 5 = 0. 5

______________________________________________________________________________

QUESTION 10:
In a Bayesian network a node with only outgoing edge(s) represents

A. a variable conditionally independent of the other variables.


B. a variable dependent on its siblings.
C. a variable whose dependency is uncertain.
D. None of the above.

Correct Answer: A. a variable conditionally independent of the other variables.

Detailed Solution : As there is no incoming edge for the node, the node is not
conditionally dependent on any other node.

___________________________________________________________________________

************END*******
Introduction to Machine Learning -IITKGP
Assignment - 4
TYPE OF QUESTION: MCQ/MSQ
Number of questions: 15 Total mark: 2 * 15 = 30

Q1.

Answer Questions 1-4 with the data provided below:


A spam filtering system has a probability of 0.95 to classify correctly a mail as spam and 0.10
probability of giving false positives. It is estimated that 0.5% of the mails are actual spam
mails.

Suppose that the system is now given a new mail to be classified as spam/ not-spam, what is
the probability that the mail will be classified as spam?
a. 0.89575
b. 0.10425
c. 0.00475
d. 0.09950

Correct Answer: b

Detailed Solution:

Let S = ‘Mails correctly marked spam by the system’, T= ‘Mails misclassified by the
system’(Marked as spam when not spam or Marked as not spam when it is a spam) , M = ‘Spam
mails’.

P(S|M) = 0.95 , P(S|M’) = 0.10 , P(M) = 0.005

We are to find the probability of mail being classified as spam which can either be if a spam
mail is correctly classified as spam or if a mail is misclassified as spam.

∴ 𝑃(𝑆) = 𝑃(𝑆|𝑀) ∗ 𝑃(𝑀) + 𝑃(𝑆|𝑀′) ∗ 𝑃(𝑀′) = 0.95 ∗ 0.005 + 0.10 ∗ 0.995


= 0.10425
Q2. Find the probability that, given a mail classified as spam by the system, the mail actually
being spam.
a. 0.04556
b. 0.95444
c. 0.00475

d. 0.99525

Correct Answer: a

Detailed Solution: We are to find P(M|S),

𝑃(𝑆|𝑀)∗𝑃(𝑀) 0.95 ∗ 0.005


𝑃(𝑀|𝑆) = = = 0.0455
𝑃(𝑆) 0.10425

Q3. Given that a mail is classified as not spam, the probability of the mail actually being not
spam
a. 0.10425
b. 0.89575
c. 0.003
d. 0.997

Correct Answer: d

Detailed Solution: We are to find P(M’|S’):


′ ′
𝑃(𝑆 |𝑀 )∗ 𝑃(𝑀′ ) (1−𝑃(𝑆|𝑀′))∗ 𝑃(𝑀′) 0.9∗0.995
′ |𝑆 ′ )
𝑃(𝑀 = = = = 0.997
𝑃(𝑆 ′ ) 1−𝑃(𝑆) (1−0.10425)

P(S|M’) calculated in question 2 and P(S) in question 1.


Q4. Find the probability that the mail is misclassified:

a. 0.90025
b. 0.09975
c. 0.8955
d. 0.1045

Correct Answer: b

Detailed Solution: We are to find P(T) now:

𝑃(𝑇) = 𝑃(𝑆 ∩ 𝑀′) + 𝑃(𝑆′ ∩ 𝑀) = 𝑃(𝑆|𝑀′) ∗ 𝑃(𝑀′) + 𝑃(𝑆′|𝑀) ∗ 𝑃(𝑀)


= 0.10 ∗ 0.995 + 0.05 ∗ 0.005

= 0.09975

Q5. What is the naive assumption in a Naive Bayes Classifier?

a. All the classes are independent of each other


b. All the features of a class are independent of each other
c. The most probable feature for a class is the most important feature to be
considered for classification
d. All the features of a class are conditionally dependent on each other.

Correct Answer: b

Detailed Solution:

Naive Bayes Assumption is that all the features of a class are independent of each other
which is not the case in real life. Because of this assumption, the classifier is called Naive
Bayes Classifier.
Q6.

Answer Questions 6-7 with the data provided below:

Consider the following dataset. a,b,c are the features and K is the class(1/0):

a b c K

1 0 1 1

1 1 1 1

0 1 1 0

1 1 0 0

1 0 1 0

0 0 0 1

Classify the test instance given below into class 1/0 using a Naive Bayes Classifier.

a b c K

0 0 1 ?

a. 0
b. 1
Correct Answer: b

Detailed Solution:
𝑃(𝐾=1)∗𝑃(𝑎=0|𝐾=1)∗𝑃(𝑏=0|𝐾=1)∗𝑃(𝑐=1|𝐾=1)
P(K=1|a=0, b=0, c=1) = [By Naive Bayes’
𝑃(𝑎=0,𝑏=0,𝑐=1)
Assumption]
3 1 2 2
= 6 ∗ 3 ∗ 3 ∗ 3[The denominator can be ignored since all the features
have the same probability for each class]

= 0.07407
3 1 1 2
P(K=0| a=0, b=0, c=1) = 6 ∗ 3 ∗ 3 ∗ 3 = 0.03703 < 0.07407

Hence, the test example will have class 1.


Q7. Find P (K=0| a=1, b=1).
1
a.
3
2
b.
3

1
c.
9

8
d.
9

Correct Answer: b

Detailed Solution:
𝑃(𝐾 = 0|𝑎 = 1, 𝑏 = 1)
𝑃(𝐾 = 0) ∗ 𝑃(𝑎 = 1|𝐾 = 0) ∗ 𝑃(𝑏 = 1|𝐾 = 0) 2
= =
𝑃(𝐾 = 0) ∗ 𝑃(𝑎 = 1|𝐾 = 0) ∗ 𝑃(𝑏 = 1|𝐾 = 0) + 𝑃(𝐾 = 1) ∗ 𝑃(𝑎 = 1|𝐾 = 1) ∗ 𝑃(𝑏 = 1|𝐾 = 1) 3

Q8.
Answer Questions 8-10 with the data given below:

A patient goes to a doctor with symptoms S1, S2 and S3. The doctor suspects disease D1and
D2 and constructs a Bayesian network for the relation among the disease and symptoms as
the following:

What is the joint probability distribution in terms of conditional probabilities?


a. 𝑃(𝐷1) ∗ 𝑃(𝐷2|𝐷1) ∗ 𝑃(𝑆1|𝐷1) ∗ 𝑃(𝑆2|𝐷1) ∗ 𝑃(𝑆3|𝐷2)
b. 𝑃(𝐷1) ∗ 𝑃(𝐷2) ∗ 𝑃(𝑆1|𝐷1) ∗ 𝑃(𝑆2|𝐷1) ∗ 𝑃(𝑆3|𝐷1, 𝐷2)
c. 𝑃(𝐷1) ∗ 𝑃(𝐷2) ∗ 𝑃(𝑆1|𝐷2) ∗ 𝑃(𝑆2|𝐷2) ∗ 𝑃(𝑆3|𝐷2)
d. 𝑃(𝐷1) ∗ 𝑃(𝐷2) ∗ 𝑃(𝑆1|𝐷1) ∗ 𝑃(𝑆2|𝐷1, 𝐷2) ∗ 𝑃(𝑆3|𝐷2)
Correct Answer: d

Detailed Solution:

From the figure, we can see that D1 and D2 are not dependent on any variable as they don’t
have any incoming directed edges. S1 has an incoming edge from D1, hence S1 depends on
D1. S2 has 2 incoming edges from D1 and D2, hence S2 depends on D1 and D2. S3 has an
incoming edge from D2, S3 depends on D2. Hence, (d) is the answer.

Q9. Suppose P(D1) = 0.4, P(D2) = 0.7 , P(S1|D1)=0.3 and P(S1| D1’)= 0.6. Find P(S1)
a. 0.12
b. 0.48
c. 0.36
d. 0.60

Correct Answer: b

Detailed Solution:

𝑃(𝑆1) = 𝑃(𝑆1|𝐷1) ∗ 𝑃(𝐷1) + 𝑃(𝑆1|𝐷1′)𝑃(𝐷1′) = 0.3 ∗ 0.4 + 0.6 ∗ 0.6 = 0.48

Q10. What is the Markov blanket of variable, S3

a. D1
b. D2
c. D1 and D2
d. None

Correct Answer: b

Detailed Solution:

In a Bayesian Network, the Markov blanket of node, X is the set consisting of

● X’s parents
● X’s children
● Parents of X’s children

In the given diagram, variable, S2 has a parent D2 and no children. Hence, the correct answer
is (b).

___________________________________________________________________________
Q11. Consider the following Bayes’ network:

Alarm1 means that the first alarm system rings, Alarm2 means that the second alarm system
rings, and Burglary means that a burglary is in progress. Now assume that:
P(Alarm1) = 0.1
P(Alarm2) = 0.2
P (Burglary | Alarm1, Alarm2) = 0.8
P (Burglary | Alarm1, ¬Alarm2) = 0.7
P (Burglary | ¬Alarm1, Alarm2) = 0.6
P (Burglary | ¬Alarm1, ¬Alarm2) = 0.5
Calculate P (Alarm2 | Burglary, Alarm1).
a. 0.78
b. 0.22
c. 0.50
d. 0.10
Correct Answer: b
Detailed Solution:

P (Alarm2 | Burglary, Alarm1) = P (Alarm1, Alarm2, Burglary) / P (Burglary, Alarm1)

= 0.016 / 0.072 ≈ 0.22 with

P (Alarm1, Alarm2, Burglary) = P(Alarm1) * P(Alarm2) * P (Burglary | Alarm1, Alarm2)

= 0.1 * 0.2 * 0.8 = 0.016

P (Alarm1, ¬ Alarm2, Burglary) = P(Alarm1) * P (¬ Alarm2) * P (Burglary | Alarm1, ¬ Alarm2)

= 0.1 * 0.8 * 0.7 = 0.056

P (Burglary, Alarm1) = P (Alarm1, Alarm2, Burglary) + P (Alarm1, ¬ Alarm2, Burglary)

= 0.016 + 0.056 = 0.072


Q12. Consider the following Bayesian network.

The values of the conditional probabilities are given below. Find 𝑃(𝐷).
Assume,
𝑃(𝐴) = 0.3
𝑃(𝐵) = 0.6
𝑃(𝐶|𝐴) = 0.8

𝑃(𝐶|𝐴) = 0.4

𝑃(𝐷|𝐴, 𝐵) = 0.7

𝑃(𝐷|𝐴, 𝐵) = 0.8

𝑃(𝐷|𝐴, 𝐵) = 0.1

𝑃(𝐷|𝐴, 𝐵) = 0.2

𝑃(𝐸|𝐶) = 0.7

𝑃(𝐸|𝐶) = 0.2

a. 0.68
b. 0.32
c. 0.50
d. 0.70

Correct Answer: b
Detailed Solution:
P(C) = P(C|A) * P(A) + P(C|𝐴) * P (𝐴) = 0.8 * 0.3 + 0.4 * 0.7 = 0.24 + 0.28 = 0.52

𝐶 = 1 - P(C) = 1 - 0.52 = 0.48


Next, let's calculate the probability of event D using the law of total probability and the given
conditional probabilities:
P(D) = P (D|A, B) * P(A) * P(B) + P(D|A, 𝐵) * P(A) * P(𝐵) + P(D|𝐴, B) * P(𝐴) * P(B) +
P(D|𝐴, 𝐵) * P(𝐴) * P(𝐵)
P(D) = 0.7 * 0.3 * 0.6 + 0.8 * 0.3 * 0.4 + 0.1 * 0.7 * 0.6 + 0.2 * 0.7 * 0.4 = 0.126 + 0.096 +
0.042 + 0.056 = 0.32
So, the probability P(D) is 0.32.

Q13.
Answer Questions 13-14 with the data given below:
In an oral exam you have to solve exactly one problem, which might be one of three types, A,
B, or C, which will come up with probabilities 30%, 20%, and 50%, respectively. During your
preparation you have solved 9 of 10 problems of type A, 2 of 10 problems of type B, and 6 of
10 problems of type C.
What is the probability that you will solve the problem of the exam?
a. 0.61
b. 0.39
c. 0.50
d. 0.20

Correct Answer: a
Detailed Solution:
A: Problem of type A.
B: Problem of type B.
C: Problem of type C.
S: You solve the problem
P(A) = 0.30
P(B) = 0.20
P(C) = 0.50
P(S|A) = 9/10
P(S|B) = 2/10
P(S|C) = 6/10
P(S) = P(S|A) P(A) + P(S|B) P(B) + P (S|C) P(C)
= (9/10) * (0.30) + (2/10) * (0.20) + (6/10) * (0.50)
= 0.61

Q14. Given you have solved the problem, what is the probability that it was of type A?
a. 0.35
b. 0.50
c. 0.56
d. 0.44

Correct Answer: d
Detailed Solution:
A: Problem of type A.
S: You solve the problem
P(A) = 0.30
P(S|A) = 9/10
P(S) = 0.61
𝟗
𝑷(𝑺|𝑨)∗ 𝑷(𝑨) ( )(𝟎.𝟑𝟎)
P(A|S) = == 𝟏𝟎
= 0.4426
𝑷(𝑺) (𝟎.𝟔𝟏)

Q15. Naive Bayes is a popular classification algorithm in machine learning. Which of the
following statements is/are true about Naive Bayes?
a. Naive Bayes assumes that all features are independent of each other, given the class.
b. It is particularly well-suited for text classification tasks, like spam detection.
c. Naive Bayes can handle missing values in the dataset without any special treatment.
d. It is a complex algorithm that requires a large amount of training data.

Correct Answers: a, b
Explanation:
a. Correct. Naive Bayes assumes that features are conditionally independent given the class.
This simplifying assumption allows the algorithm to estimate probabilities efficiently even
with a limited amount of data.
b. Correct. Naive Bayes is commonly used for text classification tasks, such as spam detection
and sentiment analysis, due to its ability to handle high-dimensional feature spaces.
c. Incorrect. Naive Bayes does not handle missing values naturally. Missing values need to be
handled before applying the algorithm.
d. Incorrect. Naive Bayes is actually known for its simplicity and ability to work well with
small amounts of training data. It is not considered complex and often provides good results
with relatively simple computations.

*******END*******
Introduction to Machine Learning
Assignment- Week 4
TYPE OF QUESTION: MCQ
Number of questions: 10 Total mark: 10 X 2 = 20
______________________________________________________________________

QUESTION 1:
A man is known to speak the truth 2 out of 3 times. He throws a die and reports that the
number obtained is 4. Find the probability that the number obtained is actually 4 :
A. 2/3
B. 3/4
C. 5/22
D. 2/7

Correct Answer : D. 2/7


Detailed Solution : Suppose,

𝐴 : 𝑇ℎ𝑒 𝑚𝑎𝑛 𝑟𝑒𝑝𝑜𝑟𝑡𝑠 𝑡ℎ𝑎𝑡 4 𝑖𝑠 𝑜𝑏𝑡𝑎𝑖𝑛𝑒𝑑.


𝐵 : 𝑁𝑢𝑚𝑏𝑒𝑟 4 𝑖𝑠 𝑜𝑏𝑡𝑎𝑖𝑛𝑒𝑑
𝑃(𝐴|𝐵)𝑃(𝐵)
𝑃(𝐵|𝐴) = here,
𝑃(𝐴|𝐵)𝑃(𝐵)+𝑃(𝐴|𝐵)𝑃(𝐵)
2 1 1 5
𝑃(𝐴|𝐵) = 3
, 𝑃(𝐵) = 6 , 𝑃(𝐴|𝐵) = 3
, 𝑃(𝐵) = 6

2
𝑃(𝐵|𝐴) = 7

_________________________________________________________________

QUESTION 2:
Two cards are drawn at random from a deck of 52 cards without replacement. What is
the probability of drawing a 2 and an Ace in that order?
A. 4/51
B. 1/13
C. 4/256
D. 4/663

Correct Answer : D. 4/663


Detailed Solution :

A : Drawing a 2

B : Drawing an Ace from the remaining 51 cards


4 1 4
𝑃(𝐴𝐵) = 𝑃(𝐴) * 𝑃(𝐵|𝐴) here, 𝑃(𝐴) = 52
= 13
, 𝑃(𝐵|𝐴) = 51

1*4 4
𝑃(𝐴𝐵) = 13*51
= 663

______________________________________________________________________

QUESTION 3:
Consider the following graphical model, mark which of the following pair of random
variables are independent given no evidence?

A. a,b
B. c,d
C. e,d
D. c,e
Correct Answer : A. a,b

Detailed Solution : Nodes a and b don’t have any predecessor nodes. As they don’t
have any common parent nodes, a and b are independent.

______________________________________________________________________
QUESTION 4:
Consider the following Bayesian network. The random variables given in the model are
modeled as discrete variables (Rain = R, Sprinkler = S and Wet Grass = W) and the
corresponding probability values are given below. (Note: (¬ X) represents complement
of X)

P(R) = 0.1
P(S) = 0.2
P(W | R, S) = 0.8
P(W | R, ¬ S) = 0.7
P(W | ¬ R, S) = 0.6
P(W | ¬ R, ¬ S) = 0.5

Calculate P(S | W, R).

A. 1
B. 0.5
C. 0.22
D. 0.78

Correct Answer : C. 0.22

𝑃(𝑊,𝑆,𝑅) 𝑃(𝑊𝑆𝑅)
Detailed Solution : 𝑃(𝑆|𝑊, 𝑅) = 𝑃(𝑊,𝑅) =
𝑃(𝑊𝑆𝑅)+𝑃(𝑊𝑆𝑅)
𝑃(𝑊𝑆𝑅) = 𝑃(𝑊|𝑆, 𝑅) * 𝑃(𝑅) * 𝑃(𝑆) = 0. 8 * 0. 1 * 0. 2 = 0. 016
𝑃(𝑊𝑆𝑅) = 𝑃(𝑊|𝑆, 𝑅) * 𝑃(𝑅) * 𝑃(𝑆) = 0. 7 * 0. 1 * 0. 8 = 0. 056
𝑃(𝑊,𝑆,𝑅) 𝑃(𝑊𝑆𝑅) 0.016
𝑃(𝑆|𝑊, 𝑅) = 𝑃(𝑊,𝑅)
= = 0.016+0.056
= 0. 22
𝑃(𝑊𝑆𝑅)+𝑃(𝑊𝑆𝑅)
______________________________________________________________________
QUESTION 5:
What is the naive assumption in a Naive Bayes Classifier?

A. All the classes are independent of each other


B. All the features of a class are independent of each other
C. The most probable feature for a class is the most important feature to be
considered for classification
D. All the features of a class are conditionally dependent on each other.

Correct Answer: B. All the features of a class are independent of each other

Detailed Solution: Naive Bayes Assumption is that all the features of a class are
independent of each other.
______________________________________________________________________

QUESTION 6:
A drug test (random variable T) has 1% false positives (i.e., 1% of those not taking
drugs show positive in the test), and 5% false negatives (i.e., 5% of those taking drugs
test negative). Suppose that 2% of those tested are taking drugs. Determine the
probability that somebody who tests positive is actually taking drugs (random variable
D).
A. 0.66
B. 0.34
C. 0.50
D. 0.91

Correct Answer : A. 0.66


Detailed Solution :
𝑃(𝑇|𝐷)𝑃(𝐷) 95 1 2
𝑃(𝐷|𝑇) = , 𝑃(𝑇|𝐷) = 100
, 𝑃(𝑇|𝐷) = 100
, 𝑃(𝐷) = 100
𝑃(𝑇|𝐷)𝑃(𝐷)+𝑃(𝑇|𝐷)𝑃(𝐷)
𝑃(𝐷|𝑇) = 0. 66
_____________________________________________________________________

QUESTION 7:
It is given that 𝑃(𝐴|𝐵) = 2/3 and 𝑃(𝐴|𝐵) = 1/4. Compute the value of 𝑃(𝐵|𝐴).
A. ½
B. ⅔
C. ¾
D. Not enough information.
Correct Solution : D. Not enough information.
Detailed Solution : There are 3 unknown probabilities 𝑃(𝐴), 𝑃(𝐵), 𝑃(𝐴𝐵) which can not
be computed from the 2 given probabilities. So, we don’t have enough information to
compute 𝑃(𝐵|𝐴).
______________________________________________________________________

QUESTION 8:
Consider the following Bayesian network, where F = having the flu and C = coughing:

Find P(C) and P(F|C).

A. 0.35, 0.23
B. 0.35,0.77
C. 0.24, 0.024
D. 0.5, 0.23

Correct Answer: A. 0.35, 0.23

Detailed Solution :

𝑃(𝐶) = 𝑃(𝐶|𝐹) * 𝑃(𝐹) + 𝑃(𝐶|𝐹) * 𝑃(𝐹)


𝑃(𝐶|𝐹)*𝑃(𝐹)
𝑃(𝐹|𝐶) =
𝑃(𝐶|𝐹)*𝑃(𝐹)+𝑃(𝐶|𝐹)*𝑃(𝐹)

______________________________________________________________________

QUESTION 9:
Bag I contains 4 white and 6 black balls while another Bag II contains 4 white and 3
black balls. One ball is drawn at random from one of the bags and it is found to be
black. Find the probability that it was drawn from Bag I.
A. 1/2
B. 2/3
C. 7/12
D. 9/23

Correct Answer : C. 7/12


Detailed Solution :

Consider the random variables:

B1: “Ball is drawn from bag I”,

B2: “Ball is drawn from bag II”,

W: “Drawn ball is white”,

B: “Drawn ball is black”

We have to find 𝑃(𝐵1|𝐵)

𝑃(𝐵|𝐵1)*𝑃(𝐵1) (6/10)*(1/2) 3/10 7


𝑃(𝐵1|𝐵) = 𝑃(𝐵|𝐵1)*𝑃(𝐵1)+𝑃(𝐵|𝐵2)*𝑃(𝐵2)
= (6/10)*(1/2)+(3/7)*(1/2)
= 3/10+3/14
= 12

______________________________________________________________________

QUESTION 10:
In a Bayesian network a node with only outgoing edge(s) represents

A. a variable conditionally independent of the other variables.


B. a variable dependent on its siblings.
C. a variable whose dependency is uncertain.
D. None of the above.

Correct Answer: A. a variable conditionally independent of the other variables.

Detailed Solution : As there is no incoming edge for the node, the node is not
conditionally dependent on any other node.

______________________________________________________________________

************END*******

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy