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

STAT154/254 Modern Statistical Prediction and Machine Learning Spring 2023

Home Assignment 3 (due March 12): Linear Regression, Classification

Theoretical Exercises

Problem 1:  Margin (6 points)

We say that a set of labeled vectors SN  (in Rp ) is linearly separable with a margin γ if there is a vector v ∈ Rp \ {0} such that for any (x,y) ∈ SN, where x ∈ Rp  and y ∈ {1, −1}:

yv,x

• Verify that this condition indeed corresponds to linear separability with distance γ from points to the hyperplane.  (3 points)

• Generalize this formula for the case where the separating hyperplane does not necessarily pass through the origin.  (3 points)

Problem 2:  Lasso interpretation (10 points)

Suppose we are minimizing

N

(yiβxiβ0 )2     subject to    β1  s,β Rp .

i=1

Denote the corresponding minimizer by s  (we assume that it is unique for the sake of simplicity).

• How will the training RSS change as s increases from 0 to infinity?  (2 points)

• How will the test RSS change in the same setup?  (2 points)

 s(⊤)x change as s

• The same question for the variance of this estimator.  (3 points)

Problem 3:  Cross validation error of Perceptron and SVM (12 points)

Assume that we are given a set of N labeled, unit norm (∥x∥2  ≤ 1 for all x in this sample), linearly separable points in Rp  with margin γ .

• Upper bound the Leave-one-out cross-validation error of SVM in terms of the number of essential support vectors.  (4 points)

• Assume that the Perceptron algorithm is run through the sample multiple times until it makes the first pass through the data without a single mistake. Upper bound the leave-one-our error of the classifier that corresponds to the weights that made this mistakes-free pass in terms of the margin.  (5 points)

• Explain how your findings imply that both algorithms have small prediction risk when the sample size goes to infinite. Specify which statistical model (data-generating model) you are using.  (3 points)

Hint:  for simplicity we consider the Perceptron algorithm with zero intercepts and intialization w1 = 0.

Problem 4 (M): Ridge regression with non-zero intercept (8 + 8 = 16 points)

Exercise 3.5 in ESL book, page 95.

Computational Exercises

Problem 5:  Classification on MNIST (13 points)

MNIST, which stands for  Modified National Institute of Standards and Technology,” is consid- ered the standard introductory dataset for computer vision. It was first introduced in 1999 and has since been used as a benchmark for testing classification algorithms based on handwritten images. Despite the emergence of new machine learning techniques, MNIST continues to be a trustworthy resource for both researchers and learners. In this exercise, we will tune different classifiers using 10-   fold cross-validation on MNIST. You are to tune the following classifiers: Logistic  Regression,  Linear  Discriminant  Analysis  (LDA),  Quadratic  Discriminant  Analysis  (QDA)  and  Naive Bayes. You are to download the training and the test data from the classes drive folder.

1.  The pixel values in both the training set ranges in  [0 , 255],  thus divide them by  255 to normalize them between [0, 1].  (1 point)

2. Individually train Logistic  Regression,  LDA and QDA on the training set.  (4 points)

3.  Train the Naive  Bayes classifier by tuning the bandwidth parameter using a 10-fold cross- validation on the training set. You may use repeats (if your machine permits) to get a better tuning of the methods.  As a performance validity, use ROC-AUC as a measure to tune in your 10-fold Cross Validation (5 points)

4.  Compare the four methods on the training set using accuracy and comment on their perfor- mances. Are any of them over-fitting?  (3 points)

Problem 6:  Ridge Regression (11 points)

In this exercise, we will predict the number of applications received using the other variables in the College data set.

1.  Split the data set into a training set and a test set. You may do a 80 − 20 split of the data. You also may normalize the data but be careful to use the same transformation on both the training and test data.  (1 point)

2. Fit a linear model using least squares on the training set and report the test error obtained. (2 points)

3. Fit a ridge regression model on the training set, with λ chosen by cross-validation.  Report the test error obtained.  You may choose the number of folds you wish or use LOO Cross- Validation.  (3 points)

4. Fit a LASSO model on the training set, with λ chosen by cross-validation.  Report the test error obtained. You may choose the number of folds you wish or use LOO Cross-Validation. Report the number of non-zero coefficient estimates.  (3 points)

5.  Comment on the results obtained.   How accurately can we predict the number of college applications received? Is there much difference among the test errors resulting from these five approaches?  (2 points)

You may use MSE as a measure of error.