%%%%%%%%%%%%%%%%% DO NOT CHANGE HERE %%%%%%%%%%%%%%%%%%%% {
\documentclass[12pt,letterpaper]{article}
\usepackage{fullpage}
\usepackage[top=2cm, bottom=4.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\usepackage{lastpage}
\usepackage{enumerate}
\usepackage{fancyhdr}
\usepackage{mathrsfs}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{hyperref}
\usepackage{todonotes}[disable]
\usepackage{esvect}

\hypersetup{%
  colorlinks=true,
  linkcolor=blue,
  linkbordercolor={0 0 1}
}

\setlength{\parindent}{0.0in}
\setlength{\parskip}{0.05in}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% }

%%%%%%%%%%%%%%%%%%%%%%%% CHANGE HERE %%%%%%%%%%%%%%%%%%%% {
\newcommand\course{CMPT 727}
\newcommand\semester{Spring 2022}
\newcommand\hwnumber{5}                 % <-- ASSIGNMENT #
%\newcommand\NetIDa{Your Name}           % <-- YOUR NAME
%\newcommand\NetIDb{200XXYYZZ}           % <-- STUDENT ID #
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% }

%%%%%%%%%%%%%%%%% DO NOT CHANGE HERE %%%%%%%%%%%%%%%%%%%% {
\pagestyle{fancyplain}
\headheight 35pt
\chead{\textbf{\Large Assignment \hwnumber}}
\rhead{\course \\ \semester}
\lfoot{}
\cfoot{}
\rfoot{\small\thepage}
\headsep 1.5em
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% }


\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\begin{document}

\section*{Problem 1 }


The Poisson distribution is defined as \[\text{Poi}(x|\lambda) = e^{-\lambda}\frac{\lambda^x} {x!},\] for $x \in \{0,1,2,\dots\}$ where $\lambda > 0$ is the rate parameter.
Suppose we have observed $\{x_1, x_2, \dots x_n\}$ drawn from $\text{Poi}(\lambda)$
What is the MLE of $\lambda$?



\section*{Problem 2}
Consider samples $x_1,\dots,x_n$ from a Gaussian random variable with known variance $\sigma^2$ and unknown mean $\mu$.
We further assume a prior distribution (also Gaussian) over the mean, $\mu \sim \mathcal{N}(m,s^2)$, with fixed mean $m$ and fixed variance $s^2$. Thus the only unknown is $\mu$.
\begin{enumerate}
    \item Calculate the MAP estimate $\hat{\mu}_{MAP}$ . You can state the result without proof. Alternatively, with a bit more work, you can compute derivatives of the log posterior, set to zero and solve.


    \item Show that as the number of samples $n$ increase, the MAP estimate converges to the maximum likelihood
estimate.


    \item Suppose $n$ is small and fixed. What does the MAP estimator converge to if we increase the prior variance $s^2$?


    \item Suppose $n$ is small and fixed. What does the MAP estimator converge to if we decrease the prior variance $s^2$?


\end{enumerate}

\section*{Problem 3}
Let $\theta$ be a univariate, continuous parameter.
Consider the following optimization, which adds a regularization term to the log likelihood to identify a regularized MLE.

\begin{equation*}
    \hat{\theta}_{reg} = \argmin_{\theta} -\log p(D | \theta) + \lambda C(\theta) \quad \quad \lambda > 0
\end{equation*}

\begin{enumerate}

    \item As an alternative, we can define the MAP estimate $\hat{\theta}_{MAP}$ for a particular choice of prior $p(\theta)$. Define a probability distribution $p(\theta)$ as a function of $C(\theta)$ such that $\hat{\theta}_{MAP} = \hat{\theta}_{reg}$. You may assume that $C$ has a finite integral.


    \item According to $p(\theta)$, what is the relative probability of two parameters $p(\theta_1)/p(\theta_2)$?



    \item Based on your answer to (2), qualitatively, how does $p(\theta)$ change as we decrease $\lambda$? Increase?


\end{enumerate}

\section*{Problem 4}
On average, how many hours have you spent on each assignment so far in this course?


\section*{Problem 5}
Please write one thing from this course you found confusing, a topic you would like to hear more about, or something you found particularly interesting.





\end{document}
