Let std::vector<int> counts
be a vector of positive integers and let N:=counts[0]+...+counts[counts.length()-1]
be the the sum of vector components. Setting pi:=counts[i]/N
, I compute the entropy using the classic formula H=p0*log2(p0)+...+pn*log2(pn)
.
The counts
vector is changing --- counts are incremented --- and every 200 changes I recompute the entropy. After a quick google and stackoverflow search I couldn't find any method for incremental entropy computation. So the question: Is there an incremental method, like the ones for variance, for entropy computation?
EDIT: Motivation for this question was usage of such formulas for incremental information gain estimation in VFDT-like learners.
Resolved: See this mathoverflow post.