Question

. Question 3 (5 pts]: Given the following six instances cach with five attributes (Outlook, Temperature, Humidity, Wind, Day)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. Entropy of whole system

The entropy characterizes the (im)purity of an arbitrary collection of examples.

In Class, there are two values Yes and No

So, there are total = 6 instances : 3 Yes = 3/6 and 2 No = 3/6

Entropy(Class) = - [(3/6)log2(3/6) + (3/6)log2(3/6)]

= 0.5 x 1 + 0.5 x 1 = 1

2. Information Gain for attribute "Outlook"

Information Gain is the expected reduction in entropy caused by partitioning the examples according to a given attribute

Outlook has 3 values i.e Sunny, Rain and Overcast.

Sunny = 3/6

Rain = 1/6

Overcast = 2/6

Now, Let's find out entropy for each values

Entropy(Sunny) :

(Sunny, No) = 2 = 2/3 , (Sunny,Yes) = 1 = 1/3

Entropy = -(2/3 log2 2/3 + 1/3 log2 1/3) = 0.387 + 0.53 = 0.917

Similarly,

Entropy(Rain) = -(1 x log2 1 ) = 0

Entropy(Overcast) = 1

Hence, Entropy(Outlook) = 3/6 x 0.917 + 1/6 x 0 + 2/6 x 1 = 0.7885

Information Gain = G(Outlook) = Entropy(Class) - Entropy(Outlook) = 1 - 0.7885 = 0.2115

Hence, Information gained = 0.2115

3. Gini Index for Outlook :

Let represent Gini index by P()

So, in Outlook,

P(Outlook = Overcast): 2/6

P(Outlook = Rain): 1/6

P(Outlook = Sunny): 3/6

If (Outlook = Overcast and Class = yes), probability = 1/2

If (Outlook = Overcast and Class = No)), probability = 1/2

Gini index = 1 - ((1/2)^2 + (1/2)^2) = 0.5

If (Outlook = Rain and Class = yes), probability = 1/1

If (Outlook = Rain and Class = No)), probability = 0/1

Gini index = 1 - ((1/1)^2 + (0/1)^2) = 0

If (Outlook = Sunny and Class = yes), probability = 1/3

If (Outlook = Sunny and Class = No)), probability = 2/3

Gini index = 1 - ((1/3)^2 + (2/3)^2) = 0.46

Hence,

Gini index(Outlook) = 2/6 x 0.5 + 1/6 x 0 + 3/6 x 0.46 = 0.397

4. Information gain and Gini index for "Day" will be 0 as Day has all unique values and unique values always gives the result 0 in Information gain and Gini index.

Add a comment
Know the answer?
Add Answer to:
. Question 3 (5 pts]: Given the following six instances cach with five attributes (Outlook, Temperature,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Given the following six instances each with five attributes (Outlook, Temperature, Humidity, Wind, Day) and one...

    Given the following six instances each with five attributes (Outlook, Temperature, Humidity, Wind, Day) and one class label, calculate Entropy of the whole system • calculate Information gain for attribute "Outlook" • calculate Gini-index for attribute "Outlook" • What is the information gain and Gini-index for attribute “Day Explain why “Day" is NOT a good feature being used as the root node of a decision tree. How to avoid using “Day” as the root node to create the tree ID...

  • An example for Playing Tennis in machine learning: Attributes are Outlook, Temperature, Humidity and Wind. Data...

    An example for Playing Tennis in machine learning: Attributes are Outlook, Temperature, Humidity and Wind. Data set and some statistics are already calculated below: Day Outlook Temperature Humidity Wind Mlay Tennis DI Sunny D2 Sunny D3 Ov ercast D4 Rain DS Rain D6 Rain D7 Overast DS Sunny D9 Sunny DIO Rain DI Sunny DI2 Overcast D13 Ovencast D1411 Rain Hot Hot Hot Mild Cool Cool Cool Mild Cool Mild Mild Mild High Weak High Strong No High Weak ligh...

  • 4. Reconsider the tennis playing training examples, if B Bayesian Belief Network depicting the conditional independence...

    4. Reconsider the tennis playing training examples, if B Bayesian Belief Network depicting the conditional independence relationship between the attributes and target classification are shown as follows: Day Outlook Temperature Humidity Wind Play Tennis gh Weak No Sunny Ho gh Sunny Ho Strong No gh Weak Yes Overcast Ho Mild gh Weak Yes Rain Normal Weak Yes Rain Coo Normal Rain Coo Strong No Normal Strong Yes Overcast Cool Mild gh Weak No Sunny Normal Weak Yes 9 Sunny Coo...

  • Question 5 [3 pts]: In the dataset showing in Table 1, please use Gini Index to...

    Question 5 [3 pts]: In the dataset showing in Table 1, please use Gini Index to calculate the correlation between each of the four attributes (outlook, temperature, humidity, wind) to the Class label, respectively [2 pts]. Please rank and select the most important attribute to build the root node of the decision tree [1 pt] 91N

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT