Starting from:
$35

$29

Homework 10 Solution

General Instructions: Put your answers to the following problems into a PDF document and submit as an attachment under Content  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 Blackboard Learn system by the above deadline. Note that you may submit multiple times, but we will only grade the most recent entry submitted before the above deadline.

For this homework we will be applying two different learning methods to the following 11 examples. Each example describes the Weather  {clear, cloudy, rain}, whether or not your AI homework is done (AIDone {yes, no}), and whether or not you have a costume (Costume 
{yes, no}). The class HaveFun  {yes, no} indicates whether or not you will have fun at a party under these conditions.

Weather
AIDone
Costume
HaveFun
clear
yes
yes
yes
clear
yes
no
yes
clear
no
yes
yes
clear
no
no
no
cloudy
yes
yes
yes
cloudy
no
yes
no
cloudy
no
no
no
rain
yes
yes
yes
rain
yes
no
yes
rain
no
yes
no
rain
no
no
no

    1. Naïve Bayes. Suppose we want to classify the new instance <Weather=cloudy, AIDone=yes, Costume=no> using the naïve Bayes learning method. Compute the following. Show your work. Note: only use the “add 1 / |values|” technique if the original P(attribute | class) = 0.
        a. Compute the prior probabilities P(HaveFun=yes) and P(HaveFun=no).

        b. Compute P(Weather | HaveFun) for all values of Weather  {clear, cloudy, rain} and HaveFun  {yes, no}.




        c. Compute P(AIDone | HaveFun) for all values of AIDone  {yes, no} and HaveFun 
{yes, no}.


        d. Compute P(Costume | HaveFun) for all values of Costume  {yes, no} and HaveFun
 {yes, no}.


        e. Compute P(HaveFun=yes | Weather=cloudy, AIDone=yes, Costume=no) and P(HaveFun=no | Weather=cloudy, AIDone=yes, Costume=no).


    2. Perceptron. Train a perceptron on the 11 examples in the above table and then use the perceptron to classify the new instance. Specifically,
        a. First, translate the examples (including the HaveFun class value) according to the mapping: clear  1, cloudy  2, rain  3, no 0, yes  1. Show a new table of examples using this mapping.

    The new table:

Weather
AIDone
Costume
HaveFun
1
1
1
1
1
1
0
1
1
0
1
1
1
0
0
0
2
1
1
1
2
0
1
0
2
0
0
0
3
1
1
1
3
1
0
1
3
0
1
0
3
0
0
0


        b. Train the perceptron below by updating the weights according to the perceptron learning rule (slide 35 of Learning lecture). Assume the initial weights are all equal to 1.0, and  = 0.5. Consider each example in the order presented in the table above and show the weight updates for each incorrectly-classified example. Continue until the perceptron correctly classifies all the training examples, and show the final perceptron weights. Hint: The perceptron should correctly classify all 11 examples on the 3rd pass through the examples.




        c. How would the learned perceptron classify the new instance <Weather=cloudy, AIDone=yes, Costume=no>? Show your work.

    3. 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.
        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.


More products