entropy

How to calculate clustering entropy - example and my solution given but is it correct? [closed]

只谈情不闲聊 提交于 2019-12-12 03:35:13
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I would like to calculate entropy of this example scheme http://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-clustering-1.html Equation of entropy Then the entropy is (the first line) So entropy is for this scheme For the first cluster - ( (5/6)*Log(5/6) + (1/6)*Log(1/6) ) For the second cluster - (

Computing information content in Python

自作多情 提交于 2019-12-12 03:32:45
问题 I need to compute information content from two Python lists. I understand that I can use the following formula where the probabilities are computed from the histograms of the list. Information content = sum_ij p(x_i,y_j) log_2 ( p(x_i,y_j)/(p(x_i)p(y_j) ) / - sum_i p(y_i) log_2 p(y_i) . Is there any built in Python API to compute information content? Thanks. 回答1: Check out the information_content function in the biopython library: http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc303

how to separate if and else in matlab

心已入冬 提交于 2019-12-11 20:22:53
问题 let us consider following code function averageentropy=calculate(f,y) count1=0; count0=0; n=length(f); n1=0; n0=0; entrop1=0; entrop2=0; bigp=sum(f)/n; for i=1:n if f(i)==1 && y(i)==1 count1=count1+1; end end for i=1:n if f(i)==0 && y(i)==1 count0=count0+1; end end for i=1:n if f(i)==1 n1=n1+1; end end for i=1:n if f(i)==0 n0=n0+1; end end smallpplus=count1/n1; smallpminus=count0/n0; if smallpplus==0 entrop1=0; else entrop1=-smallpplus*log2(smallpplus)-(1- smallpplus)*log2(1- smallpplus); end

Perfect/ideal hash to isolate anagrams

故事扮演 提交于 2019-12-11 19:19:09
问题 In an effort to accelerate fast-out behaviour on testing strings for anagrams, I came up with a prime-based hashing scheme -- although it looks like I wasn't the first. The basic idea is to map letters to prime numbers, and to compute the product of these primes. Any rearrangement of the letters will have the same product, and if the result can be arbitrarily large then no combination of other letters can produce the same result. I had initially envisioned this as just a hash. Eventually the

Entropy of pure split caculated to NaN

拥有回忆 提交于 2019-12-11 03:27:44
问题 I have written a function to calculate entropy of a vector where each element represents number of elements of a class. function x = Entropy(a) t = sum(a); t = repmat(t, [1, size(a, 2)]); x = sum(-a./t .* log2(a./t)); end e.g: a = [4 0] , then entropy = -(0/4)*log2(0/4) - (4/4)*log2(4/4) But for above function, the entropy is NaN when the split is pure because of log2(0) , as in above example. The entropy of pure split should be zero. How should I solve the problem with least effect on

Probability of getting the same value using Math.random

爱⌒轻易说出口 提交于 2019-12-10 21:28:29
问题 The requirement is to send a unique id to database when user click on submit button. So I am using Javascript Math.random method. I just want to know what are the chances or possibility to get same number and what bit size of using Math.random . 回答1: You're up against something called the birthday problem: even though there are 366 possible birthdays, when you get only 26 people in a room, the chance that some pair will have the same birthday is better than 50-50. In general, collisions are

Why am I getting a negative information gain?

 ̄綄美尐妖づ 提交于 2019-12-10 17:47:36
问题 [SOLVED] My mistake was that I did not realise that entropy is 0 if all are of one type. Thus if all are positive, entropy is 0 and if all are negative it is zero as well. Entropy will be 1 if equal amount are positive and negative. It does not make sense that one would get negative information gain. However based on this example I am getting a negative information gain. here is the data: And if I calculate the information gain on the Humidity attribute I get this: Obviously I am missing

Fast Shannon Entropy Calculation

ぃ、小莉子 提交于 2019-12-08 12:00:04
问题 Is there a fast way to calculate shannon entropy of a buffer of 16-bit numbers without having the calculate the log2 of every frequency count? The log calculations are quite slow. 回答1: Okay, so the answer is that there is no way to do it without calculating the log function, but if you pre-calculate the logs, it's not so bad. My buffer is 4096 bytes in size, so there are between 1..2048 of each possible 2-byte value. So the logs of 1/2048 .. 2048/2048 need to be pre-calculated. Then the

Word VBA Script for Shannon entropy of the alphabetic characters

我们两清 提交于 2019-12-08 10:37:41
问题 I have a document and want to take the Shannon entropy of each character in Word VBA. I have already calculated the Shannon entropy for each character but don't know how I would put this information in a word VBA and sum it up. Shannon entropy for each character (source: bearcave.com) Space,0.1859 A 0.0856 B,0.0139 C,0.0279 D,0.0378 E,0.1304 F,0.0289 G,0.0199 H,0.0528 I,0.0627 J,0.0013 K,0.0042 L,0.0339 M,0.0249 N,0.0707 O,0.0797 P,0.0199 Q,0.0012 R,0.0677 S,0.0607 T,0.1045 U,0.0249 V,0.0092

Image Parameters (Standard Deviation, Mean and Entropy) of an RGB Image

丶灬走出姿态 提交于 2019-12-08 04:00:08
问题 I couldn't find an answer for RGB image. How can someone get a value of SD,mean and Entropy of RGB image using MATLAB? From http://airccse.org/journal/ijdms/papers/4612ijdms05.pdf TABLE3, it seems he got one answer so did he get the average of the RGB values? Really in need of any help. 回答1: After reading the paper, because you are dealing with colour images, you have three channels of information to access. This means that you could alter one of the channels for a colour image and it could