Assignment 9

Machine Learning

• Submisssion: Turn in both a PDF and the source code on MyCourses

• Questions: Piazza

Problem 1 [50%]

For this exercise, refer to Chapter 14 of the Russel & Norvig’s Artificial Intelligence. It’s pdf should be

available on mycourses.

We have a bag of three biased coins a, b, c with probabilities of coming up heads of 0.2, 0.6, 0.8, respectively.

One coin is drawn randomly from the bag (with equal likelihood of drawing each coin), and then the coin is

flipped three times to generate outcomes X1, X2, and X3.

1. Draw the Bayesian network corresponding to this setup and define the necessary CPT.

2. Calculate which coin was most likely to have been drawn from the bag if the observed flips come out

heads twice and tails once. Hint: Need to consider only one permutation of flips.

Problem 2 [50%]

Fit a small neural network model to the ‘ISLR::Caravan” dataset (You can apparently). The description of

the datasets states:

The data contains 5822 real customer records. Each record consists of 86 variables, containing

sociodemographic data (variables 1-43) and product ownership (variables 44-86). The sociodemographic data is derived from zip codes. All customers living in areas with the same zip code have

the same sociodemographic attributes. Variable 86 (Purchase) indicates whether the customer

purchased a caravan insurance policy. Further information on the individual variables can be

obtained at http://www.liacs.nl/~putten/library/cc2000/

Predict the variable Purchase from a subset (at least 5) of the other variables. Experiment with at least two

different configurations of layers. Report how well your method works (remember a training/test set split!).

You can use the example in the class repository located at notebooks/class22/keras_example.Rmd to get

you started. See also https://keras.rstudio.com/ for a tutorial in R and https://keras.io/ for one in Python.

Even when using R, the Python decumentation for Keras maybe useful because the R library is a wrapper

around the Python package.

1