Input Attributes Output Example Alt Bar Fri Hun Pat Price Rain Res Туре Est Will Wait X1 Yes No No Yes Some $$$ No Yes X2 Yes No No Yes Full $ SS French 0-10 y₁ = Yes No Thai 30-60 y2 = No X3 No Yes No No Some $ No No Burger 0-10 y3 = Yes X4 Yes No Yes Yes Full $ Yes No Thai 10-30 Y4 = Yes X5 Yes No Yes No Full $$$ No Yes French >60 y5 = No X6 No Yes No Yes Some $$ Yes Yes Italian 0-10 Y6 = Yes X7 No Yes No No None $ Yes No Burger 0-10 y7 = No X8 No No No Yes Some $$ Yes Yes Thai 0-10 y8 = Yes X9 No Yes Yes No Full $ Yes No Burger >60 y9 = No X10 Yes Yes Yes Yes Full $$$ No Yes Italian 10-30 y10 = No X11 No No No No None $ No No Thai 0-10 Y11=No X12 Yes Yes Yes Yes Full $ No No Burger 30-60 Y12 = Yes Apply Naïve Bayes Classifier to classify the following two samples. : import pandas as pd file_path='/Users//Downloads/Data 2/ExampleTrainDataset.csv' filepath2 = '/Users//Downloads/Data data = pd.read_csv(file_path) data2 = pd.read_csv(filepath2) 2/ExampleTestDataset.csv' print(data) print(data2) x1 x2 x3 Y 012345678 2 3.0 2 0 2 3.0 4 0 2 3 9.0 1 0 3 1 0.5 2 0 4 2.0 1 0 5 7 2.0 1 1 3 2.0 5 1 5 2.0 2 1 8 2 4.0 3 1 2 226 11234 9 3 2.0 0 x1 1 1 x2 x3 Y 2 6 3 7 4 3 32243 3 1 0 2 4 0 2 2 1 4 3 31 3 1 1 1

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter4: Making Decisions
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question
PLease answer Question 4 i gave a question 1 information below  just for a reference 
 
Question#4):   Use only the “Hungry”, “Type” and “Output” columns form the table from
Question 1 for this problem.
a)  Perform one-hot encoding on suitable columns to transform the dataset.
b)  Implement the k nearest neighbor classifier with k = 3, to classify the
following samples. Show your work.
sample 1: [Hungry = “Yes” , Type = “Thai”]
sample 2: [Hungry=”No”, Type=”French”]
 
 
 
Question1):  Given the following dataset
Restaurant waiting: the problem of deciding whether to wait for a table at a
restaurant.
For this problem the output, y, is a Boolean variable that we will call WillWait.
The input, x, is a vector of ten attribute values, each of which has discrete
values:
1. Alternate: whether there is a suitable alternative restaurant nearby.
2. Bar: whether the restaurant has a comfortable bar area to wait in.
3. Fri/Sat: true on Fridays and Saturdays.
4. Hungry: whether we are hungry right now.
5. Patrons: how many people are in the restaurant (values are None, Some, and
Full).
6. Price: the restaurant’s price range ($, $$, $$$).
7. Raining: whether it is raining outside.
8. Reservation: whether we made a reservation.
9. Type: the kind of restaurant (French, Italian, Thai, or burger).
10. WaitEstimate: host’s wait estimate: 0–10, 10–30, 30–60, or >60minutes
 

Please show work and equations etc.   no cdoing required .. 

A):  [Alt = “Yes” , Bar = “ No” ]
B):  [ Alt = “Yes”, Bar=” No”, Price = “$”.   

 

 
 

 

Input Attributes
Output
Example
Alt
Bar
Fri
Hun
Pat Price Rain Res
Туре
Est
Will Wait
X1
Yes
No
No
Yes
Some $$$ No Yes
X2
Yes
No
No
Yes
Full $
SS
French
0-10
y₁ = Yes
No
Thai
30-60
y2 = No
X3
No
Yes
No
No
Some $
No No Burger
0-10
y3 = Yes
X4
Yes
No
Yes
Yes
Full
$
Yes No Thai
10-30
Y4 = Yes
X5
Yes
No
Yes
No
Full
$$$
No Yes
French
>60
y5 = No
X6
No
Yes
No Yes
Some
$$
Yes Yes Italian
0-10
Y6 = Yes
X7
No
Yes
No
No
None
$
Yes
No
Burger
0-10
y7 = No
X8
No
No
No
Yes
Some
$$
Yes
Yes
Thai
0-10
y8 = Yes
X9
No
Yes
Yes
No
Full
$
Yes No
Burger
>60
y9 = No
X10
Yes
Yes
Yes
Yes
Full
$$$
No
Yes
Italian
10-30
y10 = No
X11
No
No
No No
None
$
No
No
Thai
0-10
Y11=No
X12
Yes
Yes
Yes
Yes
Full
$
No
No
Burger
30-60
Y12 = Yes
Apply Naïve Bayes Classifier to classify the following two samples.
Transcribed Image Text:Input Attributes Output Example Alt Bar Fri Hun Pat Price Rain Res Туре Est Will Wait X1 Yes No No Yes Some $$$ No Yes X2 Yes No No Yes Full $ SS French 0-10 y₁ = Yes No Thai 30-60 y2 = No X3 No Yes No No Some $ No No Burger 0-10 y3 = Yes X4 Yes No Yes Yes Full $ Yes No Thai 10-30 Y4 = Yes X5 Yes No Yes No Full $$$ No Yes French >60 y5 = No X6 No Yes No Yes Some $$ Yes Yes Italian 0-10 Y6 = Yes X7 No Yes No No None $ Yes No Burger 0-10 y7 = No X8 No No No Yes Some $$ Yes Yes Thai 0-10 y8 = Yes X9 No Yes Yes No Full $ Yes No Burger >60 y9 = No X10 Yes Yes Yes Yes Full $$$ No Yes Italian 10-30 y10 = No X11 No No No No None $ No No Thai 0-10 Y11=No X12 Yes Yes Yes Yes Full $ No No Burger 30-60 Y12 = Yes Apply Naïve Bayes Classifier to classify the following two samples.
: import pandas as pd
file_path='/Users//Downloads/Data 2/ExampleTrainDataset.csv'
filepath2 = '/Users//Downloads/Data
data = pd.read_csv(file_path)
data2 = pd.read_csv(filepath2)
2/ExampleTestDataset.csv'
print(data)
print(data2)
x1 x2 x3 Y
012345678
2
3.0
2 0
2
3.0
4
0
2
3 9.0
1
0
3 1 0.5
2
0
4
2.0
1
0
5
7
2.0
1
1
3
2.0
5
1
5
2.0
2
1
8 2 4.0
3
1
2
226
11234
9 3 2.0
0
x1
1 1
x2
x3 Y
2
6
3 7
4 3
32243
3 1 0
2
4 0
2
2 1
4
3
31
3 1
1 1
Transcribed Image Text:: import pandas as pd file_path='/Users//Downloads/Data 2/ExampleTrainDataset.csv' filepath2 = '/Users//Downloads/Data data = pd.read_csv(file_path) data2 = pd.read_csv(filepath2) 2/ExampleTestDataset.csv' print(data) print(data2) x1 x2 x3 Y 012345678 2 3.0 2 0 2 3.0 4 0 2 3 9.0 1 0 3 1 0.5 2 0 4 2.0 1 0 5 7 2.0 1 1 3 2.0 5 1 5 2.0 2 1 8 2 4.0 3 1 2 226 11234 9 3 2.0 0 x1 1 1 x2 x3 Y 2 6 3 7 4 3 32243 3 1 0 2 4 0 2 2 1 4 3 31 3 1 1 1
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage