CSE 6363 – *Machine Learning*

Homework 1- Spring 2019

Due Date: Feb. 8 2019, 11:59 pm

MLE and MAP

1. In class we covered the derivation of basic learning algorithms to derive a model for a coin flip task. Consider a similar problems where we monitor the time of the occurrence of a severe computer failure (which requires a system reboot) and which occurs according to a Poisson process (i.e. it is equally likely to happen at any point in time with an arrival rate of * λ *). For a Poisson process the probability of the first event to occur at time

*after a restart is described by an exponential distribution:*

*x** p_{λ}*(

*) =*

*x**−λx*

*λe*We are assuming here that the different data points we measured are independent, i.e. nothing changes between reboots.a) Derive the performance function and the optimization result for analytic MLE optimization for a model learning algorithm that returns the MLE for the parameter * λ *of the model given a data set

*= {*

*D*

*k*_{1}

*}. Make sure you show your steps.b) Apply the learning algorithm from a) to the following dataset:*

*, …k*_{n}*= {1*

*D**5*

*.**3*

*,**2*

*,**5*

*.**2*

*,**75*

*.**2*

*,**9*

*.**3}*

*,**c) Derive the optimization for a MAP approach using the conjugate prior, the Gamma distribution.*

*.*The Gamma distribution is:

Note that * α *and

*are constants and that there still is only one parameter,*

*β**, to be learned. Show your derivation and the result for the data in part*

*λ**) and values for*

*b**and*

*α**of 5 and 10, respectively.*

*β*# K Nearest Neighbor

1. Consider the problem where we want to predict the gender of a person from a set of input parameters, namely height, weight, and age. Assume our training data is given as follows:

a) Using Cartesian distance as the similarity measurements show the results of the gender prediction for the following data items for values of * K *of 1, 3, and 5. Include the intermedia steps (i.e. distance calculation, neighbor selection, prediction).

(155* , *40

*35)*

*,**(170*

*,**70*

*,**32)*

*,**(175*

*,**70*

*,**35)*

*,**(180*

*,**90*

*,**20)*

*,*b) Implement the KNN algorithm for this problem. Your implementation should work with different training data sets and allow to input a data point for the prediction.

c) Repeat the prediction using KNN when the age data is removed. Try to determine (using multiple target values) which data gives you better predictions. Show your intermediate results.

# Gaussian Na¨ıve Bayes Classification

1. Using the data from Problem 2, build a Gaussian Na¨ıve Bayes classifier for this problem. For this you have to learn Gaussian distribution parameters for each input data feature, i.e. for * p*(

*|*

*height**)*

*W**(*

*, p**|*

*height**),*

*M**(*

*p**|*

*weight**)*

*W**(*

*, p**|*

*weight**)*

*M**(*

*, p**|*

*age**)*

*W**(*

*, p**|*

*age**).*

*M*a) Learn/derive the parameters for the Gaussian Na¨ıve Bayes Classifier and apply them to the same target as in problem 2* b*). Show your intermediate steps.

b) Implement the Gaussian Na¨ıve Bayes Classifier for this problem.

c) Repeat the experiment in part 2* c*) with the Gaussian Na¨ıve Bayes Classifier.

d) Compare the results of the two classifiers and discuss reasons why one might perform better than the other.