Example calculation of entropy, Computer Engineering

Assignment Help:

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.


Related Discussions:- Example calculation of entropy

What is the purpose of the enableevents() method, The enableEvents() method...

The enableEvents() method is used to enable an event for a certain object. Normally, an event is enabled when a listener is added to an object for a certain event. The enableEvents

Define the three prime processes of UML, Define the three prime processes o...

Define the three prime processes of uml The three prime processes were OMT (Rumbaugh), OOSE (Jacobson) and Booch. OMT was strong in analysis, while Booch was strong in design a

Define google calendar, Define Google calendar Google Calendar is free,...

Define Google calendar Google Calendar is free, full featured, and easy to use. It lets the user create both personal and shared calendars, which makes it ideal for tracking bu

Example on cyclic distribution of data, Q. Example on Cyclic Distribution o...

Q. Example on Cyclic Distribution of data? !HPF$ PROCESSORS P1(4) !HPF$ TEMPLATE T1(18) !HPF$ DISTRIBUTE T1(CYCLIC) ONTO P1 The result of these instructions is display

The concept of electronic cash, The concept of electronic cash is to implem...

The concept of electronic cash is to implement payment by Using computers over network

What are compilers and interpreters, What are compilers and interpreters? ...

What are compilers and interpreters? Compiler and Interpreter: These are two types of language translators. A compiler changes the source program (user-written program) int

What is non-volatile bios, Nonvolatile BIOS memory refers to a small memory...

Nonvolatile BIOS memory refers to a small memory on PC motherboards that is used to kept BIOS settings. It was traditionally known as CMOS RAM because it used a volatile, low-power

Three firm capabilities that are performance in e-commerce, Three firm capa...

Three firm capabilities that are critical for superior firm performance in e-commerce are:- 1.  Information technology capability,  2.  Strategic flexibility, and  3.  Tr

Explain the race around condition, Explain the Race Around Condition? C...

Explain the Race Around Condition? Consider the inputs of the JK flipflop j=1 and k=1 and Q=0 when a clock pulse of width tp is applied the output will change from 0 to 1 after

What is swimlane, What is swimlane? In business model, it is often help...

What is swimlane? In business model, it is often helpful to know which human organization is responsible for activity. Show the partition of activities into columns and lines.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd