[SOLVED] CPTS540-Homework 10

20.99 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

Rate this product
  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 <Party=yes, Sleep=yes, Study=yes> using the Naïve Bayes learning method. Compute the 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

 

  1. Compute the prior probabilities P(Pass=yes) and P(Pass=no).
  2. Compute P(Party | Pass) for all combinations of Party  {yes, no} and Pass  {yes, no}.
  3. Compute P(Sleep | Pass) for all combinations of Sleep  {yes, no} and Pass  {yes, no}.
  4. Compute P(Study | Pass) for all combinations of Study  {yes, no} and Pass  {yes, no}.
  5. Compute P(Pass=yes | Party=yes, Sleep=yes, Study=yes) and P(Pass=no | Party=yes, Sleep=yes, Study=yes).
  6. Which class would Naïve Bayes choose for the new instance?

 

 

1

  1. 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,
    1. First, translate the examples (including the Pass class value) according to the mapping: no→ 0, yes → Show a new table of examples using this mapping.
    2. 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 3rd pass through the examples.
    3. How would the trained perceptron classify the new instance <Party=yes, Sleep=yes, Study=yes>? Show your work.

 

 

 

 

  1. 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.
    1. Download and install WEKA from cs.waikato.ac.nz/ml/weka/downloading.html.
    2. Start WEKA and choose the Explorer mode.
    3. Under the Preprocess tab, choose “Open file…” and load your ARFF file.
    4. Under the Classify tab, choose the “bayes→NaiveBayes” classifier.
    5. Under Test options, choose “Use training set”.
    6. Click Start to run the classifier on your data.
    7. Include your ARFF file and WEKA’s output in your submission.
Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.