$30
General Instructions: Put your answers to the following problems into a PDF document and upload the document as your submission for Homework 10 for the course CptS 440 Pullman (all sections of CptS 440 and 540 are merged under the CptS 440 Pullman section) on the Canvas system by the above deadline. Note that you may submit multiple times, but we will only grade the most recent entry submitted before the deadline.
Consider the table of data below, which contains 11 examples of the class value BuyJersey based on the features Weather, Uniform and Win. Suppose we want to classify the new instance <Weather=cloudy, Uniform=gray, Win=yes> using the Naïve Bayes learning method. Compute the following. Show your work. Note: use the “add 1 / |values|” method only if the original P(feature | class) = 0.
Weather
Uniform
Win
BuyJersey
clear
crimson
yes
yes
clear
crimson
no
yes
clear
gray
yes
yes
clear
gray
no
no
cloudy
crimson
yes
yes
cloudy
crimson
no
yes
cloudy
gray
no
no
rainy
crimson
yes
yes
rainy
crimson
no
yes
rainy
gray
yes
no
rainy
gray
no
no
Compute the prior probabilities P(BuyJersey=yes) and P(BuyJersey=no).
Compute P(Weather | BuyJersey) for all values of Weather Î {clear, cloudy, rainy} and BuyJersey Î {yes, no}.
Compute P(Uniform | BuyJersey) for all values of Uniform Î {crimson, gray} and BuyJersey Î {yes, no}.
Compute P(Win | BuyJersey) for all values of Win Î {yes, no} and BuyJersey Î {yes, no}.
Compute P(BuyJersey=yes | Weather=cloudy, Uniform=gray, Win=yes) and P(BuyJersey =no | Weather=cloudy, Uniform=gray, Win=yes).
Which class would Naïve Bayes choose for the new instance?
Perceptron. Train a perceptron on the 11 examples in the above table and then use the perceptron to classify the new instance. Specifically,Translate the examples (including the BuyJersey class value) according to the mapping: clear à 0, cloudy à 1, rainy à 2, crimson à 0, gray à 1, noà 0, yes à Show a new table of examples using this mapping.
Translate the new instance according to the mapping in part (a). Show the resulting instance. How would the perceptron below (before any training) classify the new instance? Show your work.
Train the perceptron below using one pass through the 11 examples 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 h = 0.5. Consider each example in the order presented in the table above and show the weight updates for each incorrectlyclassified example. Show your work. Hint: There should be three weight updates.
How would the trained perceptron from part (c) classify the new instance <Weather=cloudy, Uniform=gray, Win=yes>? Show your work.
CptS 540 Students Only: Put the 11 training examples from the initial table above (used in Problem 1) into an ARFF file suitable for input to WEKA. Follow the procedure below to run the Naive Bayes classifier.Download and install WEKA from cs.waikato.ac.nz/ml/weka/downloading.html.
Start WEKA and choose the Explorer mode.
Under the Preprocess tab, choose “Open file...” and load your ARFF file.
Under the Classify tab, choose the “bayes®NaiveBayes” classifier.
Under Test options, choose “Use training set”.
Click Start to run the classifier on your data.
Include your ARFF file and WEKA’s output in your submission.
Extra Credit (5 points). Continue training the perceptron in 2(c) until it correctly classifies all 11 examples. Show the final perceptron weights. Hint: The perceptron should correctly classify all 11 examples on the 6th pass through the examples (where 2(c) is the 1st pass).