关键词 > COMP4702/COMP7703

COMP4702/COMP7703 - Machine Learning Homework W3 - Parametric Models

发布时间:2022-05-14

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMP4702/COMP7703 - Machine Learning

Homework W3 - Parametric Models

Questions

1.  (3 marks) Use the following data:

x

t

0.0000 0.5236 1.0472 1.5708 2.0944 2.6180 3.1416

2.7600

-2.3902

1.3800

0.0000

-1.3800

2.3902

-2.7600

A commonly-used measure of the goodness-of-fit for a regression model is the coefficient of determi- nation (or R2). Find the (unadjusted) R2 value for each of the following functions when the sum of squared residuals is minimised. Please submit your answer correct to 4 decimal places.

(a) y = ax3 + bx2 + cx + d

(b) y = ax10 + bx9 + ... + jx + k

(c) y = a ∗ cos(5x)

2.  (3 marks) Using hw2q2Training.csv as the Training dataset and hw2q2Validation.csv as the Validation dataset, perform polynomial regression (e.g. using Matlab’s fit,  fittype and fiteval) and answer the following:

(a) Using the validation set for model selection, what polynomial degree order will be selected?

(b) What is the sum of squared error (SSE) on the validation set, recorded at order 5?  (correct to

2 decimal places)

(c) The data you have used is generated using the same function plus noise as in Prac W3. In one sentence, explain why the best order here differs to the Prac question? (1 sentence)

3.  (3 marks) In the book: Pattern Recognition and Machine Learning, by Chris Bishop (available via blackboard, under ”Books and Primary References”), an example of underfitting and overfitting is given and discussed (pages 6-9). Study Figure 1.4, Table 1.1 and Figure 1.6.

Given the model coefficient values shown in Table 1.1, what do you think the coefficient values would look like for the models shown in Figure 1.6? Answer in three sentences or less.

4.  (4 marks) In the lectures and Prac W3 we have considered parametric probabilistic classification for a binary (2-class) problem with one-dimensional input data. This can be extended to the case where we have more classes. Write a function (e.g. in Matlab or python) that takes 4 inputs:

• A n × 2 set of (training) input data. Where the first column is a one-dimensional set of data, and the second column is the class, ranging from 0 to k-1,

• k, the number of classes,

• x, an test input to classify, and

• p, the k-dimensional class prior probability vector satisfying Ppi = 1.

Your function should return the posterior probabilities for each class for the given x-value.

Using your function, plot a labelled posterior graph similar to that produced in Prac W3, where the horizontal axis represents the value of x and the vertical axis represents the posterior probabilities for each of the k classes.  Use the data provided in iris.csv, taking the first column as x and the last column as the class label. Assume an equal class prior probability.

For this question, submit your plot and a listing of your code.  You can also include command line output demonstrating usage of the code. Marking is primarily about the output of the code rather than the design.

5.  (3 marks) Measuring model complexity is a tricky business. Two well-known (and related) measures of model complexity from statistics are the Akaike Information Criterion (AIC) and the Bayesian Information Criterion (BIC). Find and read a little about the definitions of AIC and BIC.

(a) Suppose you are reading a research paper that lists the AIC and BIC for a model trained on a dataset with 1000 training points.  You would like to determine the maximum value of the likelihood.  If AIC = 20003.2189 and BIC = 69080.7717, what is the maximum value of the likelihood to four decimal places, and how many parameters does the model have?

(b) Produce a 3D plot of AIC for suitable ranges of  and k, where  is the maximum value of the

likelihood function for the model and k is the number of parameters in the model.