### 1 Probabilistic Interpretation of Ridge Regression

we can stack all our features in a * n × p *matrix,

**, and all our labels in a**

**X***1 vector*

*n ×***. We would like to use ridge regression to make our prediction, i.e.**

**y***(*

*f***) =**

**x**

**x***, and:*

*β*^{∗}where * λ *is a hyperparameter that controls the amount of regularization. Note that, when

*= 0 we get the sum of squares loss from the least squares problem. In this problem we are going to show that ridge regression has a probabilistic interpretation as a prior probability distribution over the feature weights.*

*λ***a) **Derive the closed form solution to (1) by setting the gradient of the loss function equal to 0. Now consider the following probabilistic model:

where **I*** _{n×n} *is the

*identity matrix, and we will use*

*n × n***as a shorthand for the**

**I***identity matrix. Here,*

*p × p**0 is a fixed and known precision parameter for the prior. Under this model, the full data has likelihood:*

*λ >***b)**Using Bayes’ Rule show that, up to a proportionality constant, the posterior pdf of *β|***y***, ***X*** , λ *can be written as:

Hint: “up to a proportionality constant” also includes “drop all terms that don’t include * β*,” be- cause those terms do not enter into the estimation of

*in practice.*

*β***c) **Show that, up to a proportionality constant, the pdf in b) can be expressed as:

**d) **The result in part c) looks very similar to part of the pdf of a very popular distribution. What is this distribution? Give its parameters for the case in c). Show that the Maximum a-Posteriori (MaP) estimate (this is just the maximum of the posterior distribution) for * β *under this distribution is also the solution to the ridge minimization problem in (1), i.e. show that:

* β_{MaP} *= arg max Pr(

*β|*

**y**

*,*

**X***) =*

*, λ*

*β*^{∗}*.*You can do this by appealing to known properties of the distribution you have found.

### 2 Statistical Learning Theory: Sub-Gaussian Bounds

For a random variable * X *with E[

*] = 0, we say that*

*X**is sub-Gaussian with variance proxy*

*X*

*σ*^{2}if its distribution satisfies the following:

Most known families of distributions are sub-Gaussian, and assuming that the data’s distribution is sub-Gaussian is generally considered a mild assumption, especially in comparison to assuming that the data comes from a specific distribution. While in class we have looked at distribution-free bounds, in this question we derive some useful bounds that come from assuming that the data is sub-Gaussian, a mild, yet stronger, assumption. In this problem we will show that sub-Gaussian random variables have tails that decay exponentially fast: the probability of selecting a value * t *far away from 0 decays exponentially fast as the value

*gets further and further away from 0. We will also employ a method known as Chernoff’s bounding method (Chernoff 1952), which is widely applied in statistical learning theory to construct many different types of bounds.*

*t***a) **Prove that, for all real numbers * t > *0, for sub-Gaussian distribution

*:*

*D*Hint: * e^{X} *is always positive, so Markov’s inequality applies in this case.

**b) **Starting from the result in part a) prove that

Hint: The result in part a) is true for all * s > *0 but to get the tightest possible bound we would want

*that makes the bound in a) the smallest possible. This looks a lot like a minimization problem…*

*s***c) **Let *X*_{1}* , . . . , X_{n} *be

*independent sub-Gaussian random variables all with the same variance proxy,*

*n*

*σ*^{2}. Using the tools employed in parts a) and b) prove that, for all

*0:*

*t >*### 3 K-Means as an Optimization Problem

**c) **Construct a toy dataset in which K-Means does not always converge to the globally optimal solution.

Hint: You can do this with only 3 or 4 data points and proper initialization of cluster centers.

**d) **Why does K-Means fail to find the globally optimal solution? Given this result, does the Gaussian Mixture Model (GMM) always find the globally optimal solution? You can use known facts about both algorithms and their loss functions to answer this question.

### 4 EM Algorithm for Topic Modeling

In this question we will try to design an algorithm for discovering the abstract topics that occur in a set of documents. In the problem, we have a set of * M *abstract documents in the universe,

*, which are mixtures of latent topics. We also have a dictionary of words,*

*D**, with size*

*W**. Intuitively,*

*N**is the list of all unique words that occur at least once within*

*W**. Using these two sets we can denote the number of times word*

*D**occurs in document*

*w*_{j}*as*

*d*_{i}*(*

*n**). It follows that we can represent a document*

*w*_{j}*, d*_{i}*as a vector of size*

*d*_{i}*, each entry of which corresponds to how many times word*

*N**appears in it. The topics*

*w*_{j}*are latent variables in a topic set*

*z**sized*

*Z**. Intuitively, if a document is about certain topic it will include some particular words with higher probability. For example, “music”, “show” and “film” appear frequently in documents about Arts while “school”, “student”and “teachers” usually occur if the document is about Education. Meanwhile, a document can be a mixture of several topics, e.g., a document can be about arts education for high school students. Inspired by the intuition, a reasonable approach to model the generative process is as follows.*

*K* Pr(* d_{i}, z_{k}, w_{j}*) = Pr(

*) Pr(*

*d*_{i}*) Pr(*

*z*_{k}*|d*_{i}*)*

*w*_{j}*|z*_{k}which means the topics only depend on the documents and the words only depend on topics. For computational convenience, let Pr(* d_{i}*) be a uniform distribution and Pr(

*) and Pr(*

*z*_{k}*|d*_{i}*) be Multinomial distributions. i.e.*

*w*_{j}*|z*_{k}We are interested in learning * α_{ik} *and

*because they are substantively interesting:*

*β*_{kj}*represents the proportion of topic*

*α*_{ik}*that makes up document*

*k**, and*

*i**the probability of seeing word*

*β*_{kj}*under topic*

*j**. Therefore, a single word*

*k**in a document*

*w*_{j}*is generated in this way: (1) Choose a topic*

*d*_{i}*from the topic distribution*

*z*_{k}*(*

*P r**), the probability of choosing topic*

*z*_{k}*|d*_{i}*is*

*k**; (2) Choose a word from the vocabulary distribution*

*α*_{ik}*(*

*p**) in this topic, the probability is*

*w*_{j}*|z*_{k}*. We want to learn these parameters by maximizing the likelihood of the data using the EM algorithm.*

*β*_{kj}**a) **For our set of * N *documents and

*word of choices, write down the log-likelihood of the model above, i.e.*

*W**(*

*log**(*

*p**=*

*D**=*

*d*_{i}*, W**)).*

*w*_{j}*|α, β*Remember that in the EM (Expectation-Maximization) algorithm, we can figure out the parame- ters and the hidden variables by iteratively computing (1) the distribution of latent variables using the old parameters and (2) find new parameters that maximize the likelihood using the old latent variable distribution. Now try to:

**b) **E-step: Derive the distribution of latent variable * p*(

*) by fixing the old pa- rameters.*

*z*_{k}*|w*_{j}*, d*_{i}*, α*^{old}*, β*^{old}**c) **M-step: Find the * α^{new} *and

*that optimize the log likelihood using*

*β*^{new}*(*

*p**) as the distribution of*

*z*_{k}*|w*_{j}*, d*_{i}*, α*^{old}*, β*^{old}*.*

*z*You would iterate these until convergence to get the final parameters in practice.

Just so you know, the model you have just been working with in this problem is a very famous and very popular model. 🙂

### 5 What Happens to My Gradient

In this problem you will get the chance to construct a neural network with architecture 784 * − H − H − *1, where

*is the number of hidden nodes you choose. This neural network can be used for binary classification, such 0, 1 digits classification for MNIST. The model can be represented as*

*H*The loss function for this model (or the negative log-likelihood) is the usual one:

**b) **Use the preprocessed MNIST data provided in the attachment. MNIST is a dataset of images of handwritten digits that also contain labels for the number they correspond to. We want to train a neural network to learn to recognize these handwritten digits. Use gradient descent with the gradients you have derived in part a) to train a neural network on the data. Report the accuracy for the network on the train and test data. Since the sample size is large, we can approximate the true gradient with stochastic gradient for computational convenience:

which means at each step, instead of calculating the gradients with all samples in the dataset, we randomly pick a mini-batch of samples and calculate gradient using these samples. In implementing the neural network, it would be beneficial to build and train the model in a general way. That is, build a NN with * d *hidden layers such that we can easily modify

*.*

*d***c) **In our current model, we have 2 hidden layers. What is the magnitude of *∇*** _{W}**1

*(*

*L**)? Now try to modify the the number of hidden layers*

*θ**, from 1 to 4. What happens to the magnitute of*

*d*

*∇***1**

_{W}*(*

*L**) when we increase*

*θ**? In this question, you don’t need to train the whole neural network, just initialize it with random weights, e.g.*

*d**(0*

*N**1), and calculate the gradient.*

*,***d) **Suppose that all weights are finite and the weight matrices **W**_{2}*, ***W**_{3}*, …, ***W*** _{d} *are diagonalizable matrices in which the absolute value of the eigenvalues are upper-bounded by 4

*. Prove that*

*− s*