The assignment is mainly solving the math involved step by step as detailed in assignment 4, but there are also some steps that require python code
CPSC 4820/6820: AI UNMANNED VEHICLES ASSIGNMENT 4- DUE: APRIL 7, 2022 @11:59 PM NAME: Total Points: 100 points + 10 points extra In this Assignment, we will review concepts on MLE, KL divergence, Sampling, and optimizations. Submit your solutions including your answers, source code, figures, plots, etc. as a single ZIP file. You should attach your code for Problem 2 as a separate file, but it is better to include a copy of your source code in your answers as well. (MLE) Maximum Likelihood Estimation. Problem 1. Consider we observed the following sensor readings. The readings ??1, ??2, … . ???? are iid (independent and identically distributed). Use MLE method to [30 points] ??1 = 1.2, ??2 = 1.3, ??3 = 5, ??4 = 2.6 a) find the most likely ?? and ??2 if data samples are distributed according to a Gaussian distribution ?? ∼ ??(??; ??,??2) [10 points] b) find the most likely ?? if data samples are distributed according to an exponential distribution ?? ∼ ????????(??; ??) ????(??) = � ????−???? ???? ?? ≥ 0 0 ???????? [10 points] c) find the most likely ?? and ?? if data samples are distributed according to a unform distribution over the closed range [a,b]: ?? ∼ ??????????????(??; ??, ??) ????,??(??) = � 1 ??−?? ???? ?? ≤ ?? ≤ ?? 0 ???????? [10 points] Hint: 50 % for final answers and 50% for details of your derivations, so follow the steps in lecture notes to calculate MLE. First find ????(??1) [or ????(??1): the notation is arbitrary]. Then form the likelihood ????????????ℎ????(????????,????????????????????) = ?? (??1, ??2, … . ,??) = log [ ???? (??1,??2, … . )] . Note that the independence of ??1,??2, …. Implies that ?? (??1,??2, … . ,??) = log [ ???? (??1)] +⋯+ log [ ???? (????)] This is a function of parameters ??. Note that ?? representes your parameters, so for part (a) it is ??,?????? ??2, for part (b) it is ??, for part (c) it is a,b. Now that the likelihood is a function of distribution parameters, you need to find the value of parameters that maximize the likelihood. One potential way would be taking the first derivative with respect to parameter and setting it to zero (if the likelihood is a concave function). Rejection and MCMC Sampling Problem 2. Consider the following probability distribution [40 points + 10 extra points] ??(??) = ⎩ ⎨ ⎧ ?? + ?? ???? − ?? ≤ ?? ≤ 0 ?? ???? 0 ≤ ?? ≤ ?? �??2 − (?? − 3??)2 ???? 2?? ≤ ?? ≤ 4?? 0 ???????? As given below a) find ?? so that ??(??) is a valid distribution. [10 points] Hint: The area under the curve is 1 for any valid distribution b) we can use rejection sampling to generate N=100,000 random variables distributed according to target distribution f(s). To do so, we need to select a proposal distribution g(x). Let’s use g(x)=c*N(0,1) as the proposal distribution, where N(0,1) is zero-mean unit-variance Gaussian distribution and c is a constant number. In this part use c=4; Plot the histogram of the random variables [using 100 bins] and compare it with the distribution f(x). What percentages of generated samples are rejected? [10 points] c) Repeat part b using c = 10; plot the histogram. What percentages of generated samples are rejected? [5 points] d) Repeat part b using c = 20; plot the histogram. What percentages of generated samples are rejected? [5 points] e) Compare the results in parts (b),(c),(d) and justify your observation. [10 points] f) Repeat part b but this time use MCMC sampling. Plot the histogram. Mention the main difference between the rejection and MCMC sampling. [10 extra points] Hint: For a good proposal distribution and an appropriate value of c, the result should look like: Note: Use the attached code (sampling.py) as your template. Problem 3. KL divergence [30 points] a) Find the KL divergence between two Gaussian distributions: ?? = ??(??; ??1, 1) and ?? = ??(??;??2, 1) [15 points] b) Fin the KL divergence between two exponential distributions ??1 and ??2 with parameters ??1 and ??2 [15 points] ??1(??; ??) = �??1?? −??1?? ?? ≥ 0 0 ???????? ??1(??; ??) = �??2?? −??2?? ?? ≥ 0 0 ???????? Hint: Use equation ??????(??1,??2) = ∫ ??1(??) ∞ −∞ log ??1(??) ??2(??) ???? CPSC 4820/6820: AI Unmanned Vehicles Assignment 4- Due: APRIL 7, 2022 @11:59 pm Name: