Question: please solve this. Exercise 2. Consider the following training data: The goal is to predict whether new subjects with given age income student credit _rat
please solve this.

Exercise 2. Consider the following training data: The goal is to predict whether new subjects with given age income student credit _rat ing buys_comput er s 30 high no fair no 5 30 high no excellent no [31,40] high no fair yes > 40 medium no fair yes > 40 low no fair yes > 40 low yes excellent no [31,40] low yes excellent yes 5 30 medium yes fair yes 5 30 low no fair yes > 40 medium yes fair yes 5 30 medium yes excellent yes [31,40] medium yes excellent yes [31,40] high no fair yes > 40 medium no excellent no features (age, income, student, credit rating) would buy a computer, using naive Bayes classier. (1) Compute the maximum likelihood prior distribution on the label {0,1}, where 0 ='does not buy com- puter' and 1 ='buys computer'. (ii) We will model the feature space as the following 10-dimensiona1 product space of binary values {0, 1}:1 pm = [1(age s 30), 1(age 5 [31,40]), 1(age > 40),..., 1(credit = ecellent)] e mu\". (5) Compute the maximum likelihood class-conditional probabilities of each feature. (iii) Suppose we have the following testing examples: x1 = \" age 3 30, medium income, student, fair credit rating\" (6) xz = \" age 6 [31,40], low income, not student, low credit rating\" (7) X3 = \" age > 40, high income, not student, excellent credit rating\" (8) Compute the predictive probabilities (posterior distribution of class labels) of each testing exam- ples. Make the prediction. For each example, can you tell which factor affected the most for the classication result? (iv) Write a python script (in Iupyter notebook) that implements your computation automatically. Test your code on a similar but larger (:2 100 training examples and 2 20 testing examples) dataset of your choice
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
