#### 联系方式

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codinghelp2

#### 您当前位置：首页 >> Python编程Python编程

###### 日期：2020-05-16 11:08

School of Computer Science

Artificial Intelligence

Assignment 3

Semester 1, 2020

Due 11.59 pm, Monday 8 June 2020

Your task is to perform exact inference on a PGM and also manually conduct approximate

inference and compare the results. You only need to deal with one (small) network, but you

will need to compute the exact inference and also compute approximate inference manually

(i.e. generate random numbers, use these to generate samples, count the samples, etc). You

should submit a 2-3 page report of your working and findings.

More details are as below.

There is no need to code, but you will need to work through the algorithm(s) manually on

paper. The network below shows the conditional probability relationships between variables

S (Sick), P (Pub), H (Headache), L (Lecture) and D(Doctor) which capture conditional

probabilities relating whether or not a student has a Headache to whether they are Sick,

whether they went to the Pub last night, whether they go to the 9am Lecture or not and

whether they visit a Doctor.

Figure 1: A Bayes Net representing the conditional relationships between illness, lecture

attendance, pub and doctor visits.

The queries you must solve are:

P(Sick|Lecture=true, Doctor=true)

P(Sick|Doctor=false)

P(Pub|Lecture=false)

P(Pub|Lecture=false,Doctor=true)

You must produce exact results for the first two, and both exact and approximate results (by

sampling) for the third and fourth queries. You will need to conduct manual sampling by any

method you choose to generate the approximate results. For the exact results: Undergrads

can choose any exact inference method; Postgrads will be eligible for full marks only if the

exact results are generated using variable elimination.

To “implement" your manual sampling procedure you will need generate a set of random

samples. For example, for the first query you will need to generate 3 random true/false values

(for Sick, Headache and Pub) for each sample1

. You can do this by tossing a coin, but since

you'll have to generate 3 values for each sample, this could get dull and time-consuming.

Instead I suggest you visit a website such as https://www.random.org/integers/, generate a

list of integers between 0 and 100, and treat values greater than 50 as true and less than or

equal to 50 as false. For the first query, if you decide to generate 20 samples, you'll need 60

random values (3 per sample). For the second query you'll need 80 (4 per sample).

Submission and Assessment

You should submit a pdf report of maximum 2-3 pages via MyUni (Assigments). The report

should briefly describe the algorithm you have chosen to implement, provide your exact

working for each query and a table showing the results for each (hand-written equations and

tables will not be marked). I recommend you tabulate results for 10 samples and for 20

samples and compare these to the exact results. Marks will be allocated according to the

following rubric:

? Exact results and corresponding working: 30 marks

? Approximate inference results (with working): 40 marks

? Report coherence including description of approximate inference algorithm used: 30

marks

As noted above, Postgraduates are expected to use variable elimination to generate their

exact results. If a postgrad chooses not to use variable elimination they can achieve up to

15/30 on that component. Full marks will be awarded for complete and correct results, and a

coherent description of the sampling method used. If you present results in your report that

are inconsistent with the sampling method you have attempted, and you do not acknowledge

this in your report, you will automatically be given zero marks for the Assignment and referred

Due date and late submission policy

This assignment is due 11.59pm on Monday 8th June 2020. If your submission is late the

maximum mark you can obtain will be reduced by 25% per day (or part thereof) past the due

date or any extension you are granted.

1

If you choose rejection sampling you'll need to generate true/false values for all five random variables, and

then reject any sample that does not match Lecture=false and Doctor=true