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

SCHOOL OF COMPUTING AND ENGENEERING SCIENCES

BACHELOR OF SCIENCE IN INFORMATICS AND COMPUTER SCIENCE


END OF SEMESTER EXAMINATION
ICS 3202 Artificial Intelligence
DATE: 19th January 2021 Time: 2 Hours

Instructions
1. This examination consists of FIVE questions.
2. Answer Question ONE (COMPULSORY) and any other TWO questions.

QUESTION ONE – COMPULSORY (30 MARKS)


A. A movie providing company seeks to make a model for deciding on what to provide to its Kenyan
audience based on the movie ratings dataset below. You are the lead Machine Learning Engineer,
and you seek to build a predictive model

Movie Name Duration (Minutes) Mood Age Restriction Movie Rating

Money Heist 200 Dark Adult 9.8


Prison Break 300 Semi-Dark Adult 7.1
Overcomer 90 Bright Family 8.5
Mosul 120 Semi-Dark Adult 9.0
Selina 1000 Bright Family 6.3
24 800 Bright Adult 4.8
Extraction 85 Bright Adult 7.6
Boss Baby 300 Bright Children 2.8
Caliphate 400 Dark Adult 9.0

Page 1 of 7
i. For data preprocessing, Encode the Mood feature using One-Hot Encoding and provide
the output table showing only the new columns created by the Encoding (3 marks)
ii. Explain which other feature will need encoding and why (2 marks)
iii. If you intend to build the model that can predict movie ratings on this dataset using
Decision Trees Model, and without calculation, state the feature that you will throw away
explaining why (2 marks)
B. A goods delivery robot wants to deliver food products to the cafeteria at Strathmore University
student center (STC). Currently it has managed to reach Madaraka shopping center.

VERTEX hSLD
Siwaka 200m
Ph.1a 195m
Ph.1b 70m
Phase 2 45m
J1 520m
Phase 3 207m
Parking lot 215m
Mada 700m
STC 0m

Page 2 of 7
i. Using the smart search, A* algorithm, heuristics table with SLD and the graph data
structure of Madaraka Estate/Stathmore University above, show how the robot will make its
decision to reach STC (8 marks)
ii. Explain the meaning of an Agents Performance Measure using the robot above and the total
distance covered (1 mark)
iii. The robotic agent is an example of Artificial Narrow Intelligence, explain why this is so (1
mark)
C. You wish to create an intelligence AI expert on Corona Virus Disease, as a knowledge engineer
you come across the following statement:
Coronaviruses are zoonotic, meaning they are transmitted between animals and people
i. Using propositional logic, construct a propositional sentence that fully capture knowledge
from this source to the KB (3 marks)
ii. Demonstrate how Modus Tollens rules can be used to generate new knowledge by the KBS
inference engine using your above complex sentences (2 marks)
iii. State and explain any two reasons why KBS systems are a limited AI solution to this
problem (2 marks)
D. Two self-driving cars in training & testing mode were provided with 10 images that needed
classification of which their image processing software did as per the below table compared to gold
standards of a human expert classifying the images as either static object or moving object

Real world object Object as classified by Object as classified by Object as classified by


Human Expert Self-Driving Car A Self-Driving Car B
Tree Static Static Static
Road Bump Static Static Moving
Road Pavement Static Moving Moving
Human being Moving Moving Moving
Bridge Static Static Static
Animal Moving Moving Moving
Car Moving Moving Moving
Bicycle Moving Moving Moving
Cart Moving Moving Moving
House Static Static Static

Page 3 of 7
i. Construct a confusion matrix table for image processing software of self-driving car A and
self-driving car B (2 marks)
ii. From the confusion matrix above, calculate the F1-Measure for both cars then conclude
which of the two is much safer on the road (4 marks)

QUESTION TWO (15 MARKS)


A company wishes to make their messaging app capable of intelligent next word predictions.

The train corpus starts with the statement: What are you asking and the lead NLP engineer has already
encoded it to vectors (embeddings) given below and you are to help set up the ANN model for this learning
task. Given the below embeddings and initial ANN weights:

Input_1 Input_2 Input_3 Output/Target Prediction


What are you asking
Embedding 0.8356 0.4562 0.1249 0.4763

𝑇ℎ𝑢𝑠 𝐼𝑛𝑝𝑢𝑡 𝑉𝑒𝑐𝑡𝑜𝑟 𝑥 0.8356,0.4562,0.1249 𝑎𝑛𝑑 𝑇𝑎𝑟𝑔𝑒𝑡 𝑦 0.4763

The initial weight matrices are given as:


0.2 0.3 0.5
𝑳𝒂𝒚𝒆𝒓 𝑶𝒏𝒆 𝑾𝒆𝒊𝒈𝒉𝒕𝒔
0.9 0.4 0.6
𝑳𝒂𝒚𝒆𝒓 𝑻𝒘𝒐 𝑾𝒆𝒊𝒈𝒉𝒕𝒔 0.1 0.8
A. Draw the Network putting weight values in it to visualize the model (3 marks)
𝟏
B. Calculate the 𝒚 value for the first computation of the first epoch using Sigmoid 𝝈 𝒙 as your
𝟏 𝒆 𝒙

activation function (5 marks)


C. If the values for the other 𝒚s are as given below, compute the Mean Squared Error (3 marks)
𝒚 𝒚
0.4763 𝑦𝑜𝑢𝑟 𝑣𝑎𝑙𝑢𝑒 𝑓𝑟𝑜𝑚 𝐵 𝑎𝑏𝑜𝑣𝑒
0.8695 0.5643
0.2136 0.0075
0.0487 0.1248
0.4545 0.0006

Page 4 of 7
D. You have suggested to train the model using Stochastic Gradient Descent Optimizer and the NLP
engineer is concerned on why you are not using the classical Gradient Descent, explain to them
your main reason for this your suggestion (2 marks)
E. Is this task of next word prediction a Classification or Regression ML task? Explain your answer
(2 marks)

QUESTION THREE (15 MARKS)


A food delivery company wants to identify the existing market segments for a Soda & Burger package
promotion in Nairobi to help them advertise appropriately. Below is a snap of the available data on the daily
expenditures on food 𝑥 and clothing 𝑥 of five customers:

Customer No of times bought No of times ordered


Soda 𝑿𝟏 Burger 𝑿𝟐
𝑨 2 4
𝑩 8 2
𝑪 9 3
𝑫 1 5
𝑬 8.5 1

A. Demonstrate how K-Means model can be intelligently used find the clusters by showing only the
first two epochs considering Euclidean Distance Measure and starting with two clusters 𝑎, 𝑏, 𝑑
and 𝑐, 𝑒 show all your calculations (9 marks)
B. Using KNN model show the clusters formed after the First epoch of KNN (4 marks)
C. Is the above example supervised or unsupervised learning? Why or why not? Explain (2 marks)

QUESTION FOUR (15 MARKS)


You are working on a project to help famers maximize percentage of successful harvest from sowed seeds.
Below is a data set collected in the last 13 days
A. The dataset was then used to construct an intelligent decision tree model using ID3 algorithm that
can help the farmers decide whether or not to plant seeds in any given day. Show how entropy of
column Plant Seed and information gain of column Temperature were calculated (show all your
workings). (10 marks)

Page 5 of 7
Outlook Temperature Humidity Plant Seed

Sunny Hot High No

Sunny Hot High No

Overcast Hot High Yes

Rainy Mild High Yes

Rainy Cool Normal Yes

Overcast Cool Normal Yes

Sunny Mild High No

Sunny Cool Normal Yes

Rainy Mild Normal Yes

Sunny Mild Normal Yes

Overcast Mild High Yes

Overcast Hot Normal Yes

Rainy Mild High No

B. According to WHO 13000 Kenyans lose their lives in road accidents every year while according to
McKinsey & Company, driverless technology can cut that number by 90% bringing it down to
about 1300.
i. Comment on the average 90% accuracy of autonomous vehicles, is it acceptable? In your
view how would Nairobians respond if even one life is lost in the name of a machine on
the road by itself? (2 marks)
ii. Comment on how crucial Technology Law & Ethics can help fix pressing issues that AI as
a powerful technology presents such as the one above by suggesting any three amendments
that you can propose (3 marks)

Page 6 of 7
QUESTION FIVE (15 MARKS)
A. If a Self-Driving Fire Engine was to be introduced in Nairobi, what would be the major practical
challenges that this project will face and how different will the training model be from a ‘normal’
self-driving car? Write a two-paragraph essay of not more than slightly half a page discussing this.
(8 marks)
B. An NLP researcher wants to train a question answering model to help guide tourists around Nairobi.
He has come along a Wikipedia page about Nairobi containing the below facts:

Nairobi is the capital of Kenya

Nairobi is green

Assuming sentences as documents, construct for him a term-document matrix using Tf-IDF
embedding calculations as a data preprocessing requirement (5 marks)

C. Why does the NLP engineer need to convert word to embeddings before training the model?
Explain (2 marks)

Page 7 of 7

You might also like