Example calculation of entropy, Computer Engineering

Example Calculation:

If we see an example we are working with a set of examples like S = {s1,s2,s3,s4} categorised with a binary categorisation of positives and negatives like that s1  is positive and the rest are negative. Expect further there that we want to calculate the information gain of an attribute, A, and  A can take the values {v1,v2,v3} obviously. So lat in finally assume that as: 

1745_Example Calculation of Entropy.png

Whether to work out the information gain for A relative to S but we first use to calculate the entropy of S. Means that to use our formula for binary categorisations that we use to know the proportion of positives in S and the proportion of negatives. Thus these are given such as: p+ = 1/4 and p- = 3/4. So then we can calculate as: 

Entropy(S) = -(1/4)log2(1/4) -(3/4)log2(3/4) = -(1/4)(-2) -(3/4)(-0.415) = 0.5 + 0.311

= 0.811 

Now next here instantly note that there to do this calculation into your calculator that you may need to remember that as: log2(x) = ln(x)/ln(2), when ln(2) is the natural log of 2. Next, we need to calculate the weighted Entropy(Sv) for each value v = v1, v2, v3, v4, noting that the weighting involves multiplying by (|Svi|/|S|). Remember also that Sv  is the set of examples from S which have value v for attribute A. This means that:  Sv1 = {s4}, sv2={s1, s2}, sv3 = {s3}. 

We now have need to carry out these calculations: 

(|Sv1|/|S|) * Entropy(Sv1) = (1/4) * (-(0/1)log2(0/1) - (1/1)log2(1/1)) = (1/4)(-0 -

(1)log2(1)) = (1/4)(-0 -0) = 0 

(|Sv2|/|S|) * Entropy(Sv2) = (2/4) * (-(1/2)log2(1/2) - (1/2)log2(1/2))

                                      = (1/2) * (-(1/2)*(-1) - (1/2)*(-1)) = (1/2) * (1) = 1/2 

(|Sv3|/|S|) * Entropy(Sv3) = (1/4) * (-(0/1)log2(0/1) - (1/1)log2(1/1)) = (1/4)(-0 -

(1)log2(1)) = (1/4)(-0 -0) = 0 

Note that we have taken 0 log2(0) to be zero, which is standard. In our calculation,

we only required log2(1) = 0 and log2(1/2) =  -1. We now have to add these three values together and take the result from our calculation for Entropy(S) to give us the final result: 

Gain(S,A) = 0.811 - (0 + 1/2 + 0) = 0.311 

Now we look at how information gain can be utilising in practice in an algorithm to construct decision trees.

Posted Date: 1/11/2013 6:43:07 AM | Location : United States

Related Discussions:- Example calculation of entropy, Assignment Help, Ask Question on Example calculation of entropy, Get Answer, Expert's Help, Example calculation of entropy Discussions

Write discussion on Example calculation of entropy
Your posts are moderated
Related Questions
What is reification and behaviour? Reification is the promotion of something that is not an object into an object. Behavior usually requires this description. It isn't usually

Describe the operation of parallel in parallel out (PIPO) shift register. Ans:  Parallel In Parallel Out: By the name suggests, in parallel in parallel out that is a

Question : a) Hard disk is an important component of a computer. What type of memory is it? b) With the help of a diagram describe its features. c) Explain its working pr

Q. Why we use Debugger? Debugger is a program which allows the user to test as well as debug the object file.  Theuser can use this program to perform subsequent functions.

State briefly about the  Register Transfer A micro operation is a basic operation performed on information stored in one or more registers. The result of operation may replace

Q. Illustrate the Cache Memory Operation? It comprises a copy of a part of main memory contents. When a program is running and CPU tries to read a word of memory (instruction o

How do you turn off cookies for single page in your site? We can turn off the cookies for one page:- By setting the Cookie. Discard property false.

Describe functions of data flow diagram After you have roughly designed data flow diagram, you could write a description of each function and you could describe the function i

Why a function canot have delays? However in Open Vera, delays are allowed in function. A function returns a value and hence can be used as a part of any expression. This doesn

Q. What do you mean by Information System? An information system is an planned combination of hardware, people, communication networks, software and data resources that transfo