Description
1. Consider the table of data below, which contains seven examples of the class value Pass based
on the features Party, Sleep and Study. Suppose we want to classify the new instance
following. Show your work. Note: use the “add 1 / |values|” method if the original P(feature |
class) = 0.
Party Sleep Study Pass
yes yes no no
yes no yes no
yes no no no
no yes yes yes
no yes no yes
no no yes yes
no no no no
a. Compute the prior probabilities P(Pass=yes) and P(Pass=no).
b. Compute P(Party | Pass) for all combinations of Party {yes, no} and Pass {yes, no}.
c. Compute P(Sleep | Pass) for all combinations of Sleep {yes, no} and Pass {yes, no}.
d. Compute P(Study | Pass) for all combinations of Study {yes, no} and Pass {yes, no}.
e. Compute P(Pass=yes | Party=yes, Sleep=yes, Study=yes) and P(Pass=no | Party=yes,
Sleep=yes, Study=yes).
f. Which class would Naïve Bayes choose for the new instance?
2
2. Train a perceptron on the 7 examples from the table in Problem 1 and then use the trained
perceptron to classify the new instance. Specifically,
a. First, translate the examples (including the Pass class value) according to the mapping:
no→ 0, yes → 1. Show a new table of examples using this mapping.
b. Train the perceptron below by updating the weights according to the perceptron learning
rule (slide 34 of Learning lecture). Assume the initial weights are all equal to 1.0, and the
learning rate = 0.25. Consider each example in the order presented in the table in
Problem 1 and show the weight updates for each incorrectly-classified example. Continue
until the perceptron correctly classifies all the training examples. Show the final
perceptron weights. Hint: The perceptron should correctly classify all 7 examples on the
3
rd pass through the examples.
c. How would the trained perceptron classify the new instance
3. CptS 540 Students Only: Put the 7 training examples from the table in Problem 1 into an ARFF
file suitable for input to WEKA. Follow the procedure below to run the Naive Bayes classifier.
a. Download and install WEKA from www.cs.waikato.ac.nz/ml/weka/downloading.html.
b. Start WEKA and choose the Explorer mode.
c. Under the Preprocess tab, choose “Open file…” and load your ARFF file.
d. Under the Classify tab, choose the “bayes→NaiveBayes” classifier.
e. Under Test options, choose “Use training set”.
f. Click Start to run the classifier on your data.
g. Include your ARFF file and WEKA’s output in your submission.