0% found this document useful (0 votes)
20 views2 pages

Exercise_Machine Learning_1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Exercise_Machine Learning_1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS188 Fall 2018 Section 9: Machine Learning

1 Naive Bayes
In this question, we will train a Naive Bayes classifier to predict class labels Y as a function of input features
A and B. Y , A, and B are all binary variables, with domains 0 and 1. We are given 10 training points from
which we will estimate our distribution.

A 1 1 1 1 0 1 0 1 1 1
B 1 0 0 1 1 1 1 0 1 1
Y 1 1 0 0 0 1 1 0 0 0

1. What are the maximum likelihood estimates for the tables P (Y ), P (A|Y ), and P (B|Y )?

A Y P (A|Y ) B Y P (B|Y )
Y P (Y ) 0 0 0 0
0 1 0 1 0
1 0 1 0 1
1 1 1 1

2. Consider a new data point (A = 1, B = 1). What label would this classifier assign to this sample?

3. Let’s use Laplace Smoothing to smooth out our distribution. Compute the new distribution for P (A|Y )
given Laplace Smoothing with k = 2.

A Y P (A|Y )
0 0
1 0
0 1
1 1

1
2 Perceptron
You want to predict if movies will be profitable based on their screenplays. You hire two critics A and B to read
a script you have and rate it on a scale of 1 to 4. The critics are not perfect; here are five data points including
the critics’ scores and the performance of the movie:
4
# Movie Name A B Profit?

B score
1 Pellet Power 1 1 - 3
2 Ghosts! 3 2 + 2
3 Pac is Bac 2 4 +
1
4 Not a Pizza 3 4 +
5 Endless Maze 2 3 - 1 2 3 4
A score

1. First, you would like to examine the linear separability of the data. Plot the data on the 2D plane above;
label profitable movies with + and non-profitable movies with and determine if the data are linearly
separable.

2. Now you decide to use a perceptron to classify your data. Suppose you directly use the scores given above
as features, together with a bias feature. That is f0 = 1, f1 = score given by A and f2 = score given by
B.
Run one pass through the data with the perceptron algorithm, filling out the table below. Go through
the data points in order, e.g. using data point #1 at step 1.

step Weights Score Correct?


1 [-1, 0, 0] 1·1+0·1+0·1= 1 yes
2
3
4
5

Final weights:

3. Have weights been learned that separate the data?

4. More generally, irrespective of the training data, you want to know if your features are powerful enough
to allow you to handle a range of scenarios. Circle the scenarios for which a perceptron using the features
above can indeed perfectly classify movies which are profitable according to the given rules:

(a) Your reviewers are awesome: if the total of their scores is more than 8, then the movie will definitely
be profitable, and otherwise it won’t be.
(b) Your reviewers are art critics. Your movie will be profitable if and only if each reviewer gives either
a score of 2 or a score of 3.
(c) Your reviewers have weird but di↵erent tastes. Your movie will be profitable if and only if both
reviewers agree.

You might also like