Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Department of Computer Science & Engineering

Mid Semester Examination


Winter Semester, Session: 2021-2022
Subject: Principal of Artificial Intelligence (Open Elective) Time: 1 Hours
Max. Marks: 22

Sl. Part-I ( 12 Marks: Attempt All Question) Marks


No.
1. a. Why m-estimates are used in Naïve Bayes classifier?

Answer: To handle zero conditional probability. [1 Marks]

Explanation :

If no example/training dataset contains feature value i.e. If an individual class label


for feature value is missing, then the frequency-based probability estimate will be
zero. Using the Bayes equation, when all the probabilities are multiplied, the outcome
is zero. [1 Marks]

Full Marks: 2

b. Consider the 5-Queen problem in which we need to find an arrangement of 5


Queens on a 5×5 Chessboard, such that no Queen can attack any other Queens on
the board thus, a solution requires that no two Queens share the same row,
column, or diagonal. Discuss the one possible chromosome representation, while
solving the 5-Queens problem using GA. Illustrate the execution of Cross-over
operation on chromosome.

Answer: There may be multiple ways to represent. One of them is as follows.

Represent as list of five integer values that represent position of queen no. 1-5
respectively in particular column of chess board.

For example :

[5 2 4 3 5] or
[4 3 5 1 4] or
[2 1 3 2 4] or
[5 2 3 4 1] or [2 Marks]

The crossover point will be picked after two genes.

[4 3 5 1 4]
[5 2 4 3 5]
[4 3 4 3 5]
[5 2 5 1 4] [2 Marks]

Full Marks:4

2. Consider the following knowledge base:


x: y: cat (x)  fish (y)  likes_to_eat (x, y)
x: calico (x) cat (x)
x: tuna (x)  fish (x)
tuna (Charlie)
tuna (Herb)
calico (Puss)
a. Convert these wff’s in to a PROLOG program.

Answer: PROLOG program:

likes_to_eat(X, Y) :- cat(X), fish(Y).


cat(X1) :- calico(X1).
fish(X2) :- tuna(X2).
tuna(Charlie).
tuna(herb).
calico(Puss). [2 Marks]

b. Write a PROLOG query corresponding to the question, “What does Puss like to
eat?” and show how it will be answered by your program.

Answer:
likes_to_eat (Puss, X0) ( Negation of query, i.e. proof by contradiction)

X/Puss, Y/X0 (Clause 1) (Unification)

cat(Puss), fish(X0)

X1/ Puss (Clause 2)

calico(Puss), fish(X0)

(Clause 6)

 fish(X0)

X2/ X0 (Clause 3)

Tuna(X0)

X0/ Charlie X0/ Herb


[3 Marks]

Note: Leftmost computation rule is used during unification process


Answer reported by DFS traversal of tree constructed for given query
X0 = Charlie
X0 = Herb ( In order of occurrence in program) [ 1 Marks ]

Full Marks:6

Part-II ( 10 Marks: Attempt Any One Question)


3. You are a robot in a lumber yard, and must learn to discriminate Oak wood from Pine
wood. You choose to learn a Decision Tree classifier. You are given the following
training set examples:
Example Density Grain Hardness Class
Example #1 Heavy Small Hard Oak
Example #2 Heavy Large Hard Oak
Example #3 Heavy Small Hard Oak
Example #4 Light Large Soft Oak
Example #5 Light Large Hard Pine
Example #6 Heavy Small Soft Pine
Example #7 Heavy Large Soft Pine
Example #8 Heavy Small Soft Pine
a. Which attribute would information gain choose as the root of the tree?

Oak 4, Pine 4

Density:
Heavy-6 (Oak-3, Pine-3), Linght-2 (Oak-1, Pine-1)

[ 1 Marks ]
Grain:
Small-4 (Oak-2, Pine-2), Large-4 (Oak-2, Pine-2)
Entropy(Small)=1, Entropy(Large)=1

[ 1 Marks ]
Hardness:
Hard-4 (Oak-3, Pine-1), Soft-4 (Oak-1, Pine-3)
Entropy(Hard)=0.8113, Entropy(Soft)=0.8113

[ 1 Marks ]

Hence root node is ‘Hardness’


Full Marks : 3

Note : 1 Marks awarded for correct root node attribute without any computation

b. Draw the decision tree that would be constructed by recursively applying


information gain to select roots of sub-trees, as in Decision-Tree Learning algorithm

Hard->Density (Heavy-> Oak-3, Light-> Pine-1), Entropy (Heavy)=0, Entropy


(Light)=0

Soft->Density (Heavy-> Pine-3, Light-> Oak-1), Entropy (Heavy)=0, Entropy


(Light)=0

Hard->Grain [Small-2 (Oak-2), Large-2 (Oak-1, Pine-1)], Entropy(Small)=0,


Entropy(Large)=1

Soft->Grain [Small-2 (Pine-2), Large-2 (Oak-1, Pine-1)], Entropy(Small)=0,


Entropy(Large)=1

Correct structure up to depth one [ 3 Marks]

Full Marks : 5 Marks

c. Classify these new examples as Oak or Pine using your decision tree above.
i) [Density=Light, Grain=Small, Hardness=Hard] Ans: Pine [1 Marks]
ii)[Density=Light, Grain=Small, Hardness=Soft] Ans: Oak [1 Marks]
4. Consider the following initial and goal states of a Block-World problem in FOL. 10
Show how the STRIPS method would solve this problem. Give the actual plan and
content of goal stack also.
Start: ON(A,B) ʌ ON(C,D) ʌ ONTABLE(B) ʌ CLEAR(C) ʌ ONTABLE(D) ʌ
CLEAR(A) ʌ ARMEMPTY

Goal: ON(C,B) ʌ ON(D,A) ʌ ONTABLE(B) ʌ CLEAR(C) ʌ ONTABLE(A) ʌ


CLEAR(D) ʌ ARMEMPTY

Answer:

CLEAR(B)
HOLDING(C)
HOLDING(C) ˄ CLEAR(B)
STACK(C,B)
ON(D,A)
Goal

ARMEMPTY
CLEAR(A)
ON(A,B)
ON(A,B) ˄ ARMEMPTY˄ CLEAR(A)
UNSTACK(A,B)
HOLDING(C)
HOLDING(C) ˄ CLEAR(B)
STACK(C,B)
ON(D,A)
Goal

HOLDING(C)
HOLDING(C) ˄ CLEAR(B)
STACK(C,B)
ON(D,A)
Goal

First Operator : UNSTACK(A,B) [ 1.5 Marks]

Current State Changes with help of PDA list.


ON(C,D)
CLEAR(C)
ARMEMPTY
ON(C,D) ˄ ARMEMPTY ˄ CLEAR(C)
UNSTACK(C,D)
HOLDING(C) ˄ CLEAR(B)
STACK(C,B)
ON(D,A)
Goal

HOLDING(A)
PUTDOWN(A)
ON(C,D) ˄ ARMEMPTY ˄ CLEAR(C)
UNSTACK(C,D)
HOLDING(C) ˄ CLEAR(B)
STACK(C,B)
ON(D,A)
Goal

ON(C,D) ˄ ARMEMPTY ˄ CLEAR(C)


UNSTACK(C,D)
HOLDING(C) ˄ CLEAR(B)
STACK(C,B)
ON(D,A)
Goal
Second Operator : PUTDOWN(A) [ 1.5 Marks]
Current State Changes with help of PDA list.

HOLDING(C) ˄ CLEAR(B)
STACK(C,B)

ON(D,A)
Goal
Third Operator : UNSTACK(C,D) [ 1.5 Marks]
Current State Changes with help of PDA list

ON(D,A)
Goal

Fourth Operator : STACK(C,B) [ 1.5 Marks]


Current State Changes with help of PDA list

CLEAR(A)
HOLDING(D)
HOLDING(D) ˄ CLEAR(A)
STACK(D,A)
Goal

ONTABLE(D) ˄ CLEAR(D)
PICKUP(D)
HOLDING(D) ˄ CLEAR(A)
STACK(D,A)
Goal

HOLDING(D) ˄ CLEAR(A)
STACK(D,A)
Goal

Fifth Operator : PICKUP(D) [ 1.5 Marks]


Current State Changes with help of PDA list

HOLDING(D) ˄ CLEAR(A)
STACK(D,A)
Goal

Sixth Operator : STACK(D,A) [ 1.5 Marks]


Current State Changes with help of PDA list

Stack empty and goal state achieved.

Plan:
1. UNSTACK(A,B)
2. PUTDOWN(A)
3. UNSTACK(C,D)
4. STACK(C,B)
5. PICKUP(D)
6. STACK(D,A) [ 1 Marks]

Full Marks : 10

You might also like