Implement a Naive Bayes classifier (must write own code) to predict whether it is a good...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Implement a Naive Bayes classifier (must write own code) to predict whether it is a good day to play tennis based on the information in the training data. Assume a for Laplacian is 0.8. Also, you don't need to take the log. Use the last 10 rows in this file for the test and all other rows for training. 1. (2 points) What's the prior distribution for playing/not playing tennis? 2. (2 points) Determine the likelihood for outlook (sunny/not sunny). 3. (2 points) Determine the likelihood for temperature (hot/not hot). 4. (2 points) Determine the likelihood for wind (windy/not windy). 5. (5 points) What are the posterior probabilities for the test patterns? 6. (2 points) What is the classification accuracy rate on the test set? data: Sunny Hot Windy Play Yes Yes Yes Yes Yes Yes Yes Yes 2 Yes Yes Yes No 3 Yes Yes Yes NO 4 Yes No Yes NO 5 Yes No Yes Yes 6 Yes No Yes Yes 7 Yes No Yes NO 8 Yes NO No NO 9 No NO No Yes 10 No NO No NO 11 No NO No NO 12 No NO No Yes 13 No NO No Yes 14 Yes No Yes NO 15 Yes Yes Yes Yes 16 Yes Yes Yes Yes 17 Yes Yes Yes No 18 Yes Yes Yes No Yes No 19 Yes NO 20 Yes No Yes Yes 8 1 Implement a Naive Bayes classifier (must write own code) to predict whether it is a good day to play tennis based on the information in the training data. Assume a for Laplacian is 0.8. Also, you don't need to take the log. Use the last 10 rows in this file for the test and all other rows for training. 1. (2 points) What's the prior distribution for playing/not playing tennis? 2. (2 points) Determine the likelihood for outlook (sunny/not sunny). 3. (2 points) Determine the likelihood for temperature (hot/not hot). 4. (2 points) Determine the likelihood for wind (windy/not windy). 5. (5 points) What are the posterior probabilities for the test patterns? 6. (2 points) What is the classification accuracy rate on the test set? data: Sunny Hot Windy Play Yes Yes Yes Yes Yes Yes Yes Yes 2 Yes Yes Yes No 3 Yes Yes Yes NO 4 Yes No Yes NO 5 Yes No Yes Yes 6 Yes No Yes Yes 7 Yes No Yes NO 8 Yes NO No NO 9 No NO No Yes 10 No NO No NO 11 No NO No NO 12 No NO No Yes 13 No NO No Yes 14 Yes No Yes NO 15 Yes Yes Yes Yes 16 Yes Yes Yes Yes 17 Yes Yes Yes No 18 Yes Yes Yes No Yes No 19 Yes NO 20 Yes No Yes Yes 8 1
Expert Answer:
Answer rating: 100% (QA)
Below code is in python import pandas as pd data pdreadcsvtennisdatacsv traindata datailoc10 testdata datailoc10 totalinstances lentraindata playinstances lentraindatatraindataplay yes notplayinstance... View the full answer
Related Book For
Business Analytics Communicating With Numbers
ISBN: 9781260785005
1st Edition
Authors: Sanjiv Jaggia, Alison Kelly, Kevin Lertwachara, Leida Chen
Posted Date:
Students also viewed these programming questions
-
Mr. Afriyie is the Head of a team consisting of six officers with varied job responsibilities. He is a very agreeable fellow, warm, and a devotee of Civil Service rules and regulations. He operates...
-
In this problem, we consider the analysis of the combined information from both raters on the shoulder flexion (SF) scores in the posture measurement study. Thus, the questions below concern the data...
-
1. Based on the information provided in the case below, what is the key strategic goal for Tim Hortons as of August 2014? It would be a year of dramatic change for Tim Hortons Inc. On August 26,...
-
Assume the premises: S. S-P. P~N, ~R-N. Give a detailed informal proof of: R. Number each step and give an explanation for each. Write all the steps in the proof at once in the Math Editor. (it works...
-
Depletion ComputationsMinerals At the beginning of 2010, Callaway Company acquired a mine for $850,000. Of this amount, $100,000 was ascribed to the land value and the remaining portion to the...
-
Professor Carlson's class in mechanics is comprised of 29 students of which exactly (1) Three physics majors are juniors; (2) Two electrical engineering majors are juniors; (3) Four mathematics...
-
Andy applies for a custodial supervisor position with a school district in Texas. The job description states that a preferred qualification is that the candidate be fluent in both English and Spanish...
-
The following is a list of various activities from Geiersbach Grains latest year of operations. Sale of marketable securities.......... $ 15,130 Repayment of long-term debt.......... 19,215 Payment...
-
6. 7. 8. The reaction of sulphur in alkaline medium is given below Sais) +aOH bs2 (aq) (aq) + CS0 (aq) + H2O (1) . (Integer answer) The values of 'a' is 4.5g of compound A (MW = 90) was used to make...
-
Reproduced below from Farthington Supply's accounting records is the Accounts Receivable Subledger along with selected General Ledger accounts. During the year 2014, there were no recoveries of...
-
Using the provided information how would one generate a hypothetical interim reporting financial statement Book Values $210,000 41,000 2,000 15,000 -0- $ 23,000 3,000 80,000 15,000 $389,000 Book...
-
The US government has strict accounting rules for those involved in defence contracts. This extract outlines the process and then sets out the rules for applying Standard Costing. Administratively a...
-
What are the disadvantages of divisionalisation.
-
Workaholic Becky Fuller, played by Rachel McAdams, is the executive producer of a failing early morning network TV show. Desperate to raise the ratings, she hires egomaniacal news reporter Mike...
-
What are the meeting responsibilities of both chairs and group members?
-
Matt Damon plays the central character, an astronaut stranded on Mars and later rescued, to perfection. Identify the multitude of examples of creative problem solving depicted. What creative process...
-
The Mad Dog 357 Plutonium 9 Million Scoville Pepper Extract comes in bottle that are cylindrical in shape with a radius of 2.5 cm and a height of 6 cm. The bottle is filled with squirts of pepper...
-
Give the products of the following reaction, where T is tritium: dioldehydrase Ad- CH CH3C-COH CoIII) coenzyme B12
-
The accompanying table shows a portion of the annual returns (in %) for a technology mutual fund and an energy mutual fund from 1982 through 2018. a. Which fund had the higher average return? b....
-
The following table lists a portion of the average price (in $) for a gallon of gas for the 50 states and the District of Columbia as reported by AAA Gas Prices on January 2, 2019. a. Construct the...
-
On average, a smartphone battery lasts about 6.5 hours with normal usage. The smartphone battery life follows an exponential distribution. Use Analysis ToolPak or R, both with a seed of 1, to...
-
If, during a stride, the stretch causes her center of mass to lower by \(10 \mathrm{~mm}\), what is the stored energy? A. \(3.0 \mathrm{~J}\) B. \(6.0 \mathrm{~J}\) C. \(9.0 \mathrm{~J}\) D. \(12...
-
A \(1.00 \mathrm{~kg}\) block is attached to a horizontal spring with spring INT constant \(2500 \mathrm{~N} / \mathrm{m}\). The block is at rest on a frictionless surface. A \(10.0 \mathrm{~g}\)...
-
We can make a static measurement to deduce the spring constant to use in the model. If a \(61 \mathrm{~kg}\) woman stands on a low wall with her full weight on the ball of one foot and the heel free...
Study smarter with the SolutionInn App