Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement a Naive Bayes classifier (must write own code) to predict whether it is a good day to play tennis based on the information
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
Step by Step Solution
★★★★★
3.41 Rating (160 Votes )
There are 3 Steps involved in it
Step: 1
Below code is in python import pandas as pd data pdreadcsvtennisdatacsv traindata datailoc10 testdata datailoc10 totalinstances lentraindata playinstances lentraindatatraindataplay yes notplayinstance...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started