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

MATH6138: Data Mining and Analytics

Problem Set 1

2022

Problem 1

Consider the following sample:

(x1 ,y1 ) = (1, 1),  (x2 ,y2 ) = (2, 5),  (x3 ,y3 ) = (3, 8),  (x4 ,y4 ) = (4, 18).

a.  Suppose you predict y based on x with a linear model y = a+bx so that the mean squared error of the model is minimised.  What is a and b?  What is the RMSE and R2  of this model?

b.  Suppose you predict instead with model y = a + bz, where z is a new feature that you defined to be z = x2 . If you minimise the mean squared error of this model, what would be a and b? What is the RMSE and R2  of this model?

c.  Draw the data points and the two models above on a graph. (Be careful about your axes!)

Problem 2

Consider the same sample as above.

a. Write down an optimisation problem that minimises the sum of absolute errors of the simple linear model y = a + bx.

b. Is this optimisation problem constrained?  Is the objective function differentiable?  (Op- tional: Is the objective function convex?)

c. Write down a linear program that is equivalent to the problem above.

[Note that this part of the question requires MATH6002/6161 knowledge.  So here is a hint: you need to define a new variable for each data point and add some constraints to make sure that the optimal value of this new variable is equal to the absolute error made at this point.]

d. Now, let your data to be (xi,yi) for i = 1, . . . ,n.  Generalise your answers to parts (a) and(c) for this dataset. Define any new notation used.

Problem 3

Suppose we have n data points in Rp  and we would like to calculate all pairwise dot (inner) products between them. Write a single matrix multiplication that does this.  (You will need to define some vectors and matrices carefully!)

Problem 4

Consider the following sample:

(x11 ,x12 ,y1 ) = (1, 3, 4),  (x21 ,x22 ,y2 ) = (2, 1, 5),  (x31 ,x32 ,y3 ) = (3, 0, 7).

a. If we fit a multiple linear regression model that uses both input variables x1  and x2  to this data, what would be the R2 ?  Explain your answer.  (You can answer this question without calculating the model!)

b. Assume another data point is added to your sample:  (x41 ,x42 ,y4 ) = (4, −2, 6).

Find the coefficients of the linear model y = β0 + β1x1 + β2x2  that minimises the sum of squares error using normal equations. Justify that this solution is unique.

Problem 5

Let’s say that you have estimated the following logistic regression model to calculate the log odds of a 4 year old child being obese (y = 1) using the independent variable weight in kgs (x):

Log(Odds(x)) = −2 + 0.15x

a. What is the estimated probability of being obese for a 12kg child of the same age group?

b. What is the estimated probability of being obese for a 24kg child of the same age group?