Question

In: Computer Science

Sunny true None Play rain True Slight Stay Home overcast false slight Play rain false heavy...

Sunny

true

None

Play

rain

True

Slight

Stay Home

overcast

false

slight

Play

rain

false

heavy

Stay Home

Sunny

true

none

Play

overcast

false

slight

Play

a. Using the above datasets, calculate the Prior probabilities for each class label. Clearly show your calculations.

b. Calculate the Conditional Probabilities for All attributes. Clearly show your calculations.

c. What is the most likely classification using Naïve Bayes Algorithm for the following unseen instance (show your calculations):

overcast

true

heavy

??????

Question 2:      [10 Marks]

Consider the following dataset:

(a) Based on the nearest neighbors with 2D graph, what is the classification for the following unseen attributes using K nearest neighbors (K=3), show the calculation within X Y Graph?

instance 6

3.2

5.4

??

Instances

Attribute 1

Attribute 2

Class

instance 1

0.8

6.3

Positive

instance 2

1.4

8.1

Negative

instance 3

1.2

7.4

Positive

instance 4

6.2

14.3

Positive

instance 5

6.8

11.6

Negative

Solutions

Expert Solution

Question 1

(a) Prior Probabilities of each Class Label:

Stay Home = 2/6 = 0.3334

Play = 4/6 = 0.6667

(b) Conditional Probabilities for each attributes are:

Outlook (X1) P(X1/Y=Play) P(X1/Y=Stay Home)
Sunny 2/4 0/2
Rain 0/4 2/2
Overcast 2/4 0/2
Windy (X2) P(X2/Y=Play) P(X2/Y=Stay Home)
True 2/4 1/2
False 2/4 1/2
Rain (X3) P(X3/Y=Play) P(X3/Y=Stay Home)
None 2/4 0/2
Slight 2/4 1/2
Heavy 0/4 1/2

(c) Predicting using Naive Bayes

X1 = Overcast, X2 = True and X3 = Heavy

P(Play/X) = 2/4 * 2/4 * 0/4 * 4/6 = 0

P(Stay Home/X) = 0/2 * 1/2 * 1/2 * 2/6 = 0

In order to calculate any legitimate value to probability, adding 0.01 to both the probabilities result to smoothen the function value.

P(Play/X) = 0.01

P(Stay Home/X) = 0.01

As P(Play/X) + P(Stay Home/X) = 1

Hence, converting these numbers to make sum = 1

P(Play/X) = 0.5 and

P(Stay Home/X) = 0.5

Both the probabilities are same, and hence

(i) As the prior probability of Playing is >= 0.667, hence

Then it will be classified into Stay Home as p < 0.667

Question 2

From the above graph the three nearest neighbors of unseen attribute are (0.8 , 6.3), (1.4 , 8.1), (1.2 , 7.4)

out of which 2 is postive and 1 is negative..

So the unseen attribute is classified as positive.


Related Solutions

(a) Microorganisms play a role in the formation of hardness in groundwater. True or false? Explain....
(a) Microorganisms play a role in the formation of hardness in groundwater. True or false? Explain. (b) In the United States, chlorine is preferred as a disinfectant over ozone because it has a residual. Why is the presence of a residual important? In recent years ozone has been replacing chlorine as the primary disinfectant in the United States. What are the advantages and disadvantages of this?
The hypothalamus does not play a role in controlling blood glucose levels. True False
The hypothalamus does not play a role in controlling blood glucose levels.  True  False
True or False: Horizontal gene transfer may play a role in the evolution of prokaryotes (e.g.,...
True or False: Horizontal gene transfer may play a role in the evolution of prokaryotes (e.g., in the spread of bacterial antibiotic resistance), but does not play a role in the evolution of eukaryotes (e.g., in humans).
True or False Because it involves genetic modification, biotechnology does not play a role in sustainable...
True or False Because it involves genetic modification, biotechnology does not play a role in sustainable agriculture.
Part B: True/False Questions An expense item allocated by the home office to a branch is...
Part B: True/False Questions An expense item allocated by the home office to a branch is recorded by the branch by a debit to an expense account and a credit to the Home Office account. The balance of the Allowance for Overvaluation of Inventories: Branch ledger account is deducted from the balance of the Investment in Branch account in the separate balance sheet of the home office. A debit to the Home Office ledger account and a credit to the...
The below statements are true/False? 963.Sphingolipids play an important role in cardiac tissues. 962.Lung surfactant is...
The below statements are true/False? 963.Sphingolipids play an important role in cardiac tissues. 962.Lung surfactant is a kind of phospholipid. 961.Acyl Carrier Protein (ACP) is specially used for fatty acid synthesis. 960.Carnitine is a carrier for fatty acid for transportation from the cytosol to the mitochondrial matrix. 959.Both even- and odd-carbon chain fatty acids are catabolized by beta-oxidation. 958.LDL uptake in cells is mediated by receptors. 957.Total cholesterol content in HDL is higher than that of LDL.
1a) True or false? Your credit score can affect your home and auto insurance rates. 1b)...
1a) True or false? Your credit score can affect your home and auto insurance rates. 1b) According to credit agency Experian, which of these is among the five biggest factors in determining your credit score? A) Your payment history B) Credit Utilization C) late payments D) All of the above
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT