I'm looking at Shannon entropy, and generaly at ways to tell noise from signal when observing intraday returns (at the minute level for now). In python, e.g. I've implemented the fomula (sum of P(xi)*logP(xi) using a numpy histogram.
def rolling_entropy(window): cx = np.histogram(window, bins) c_normalized = cx/float(np.sum(cx)) c_normalized = c_normalized[np.nonzero(c_normalized)] h = -sum(c_normalized * np.log(c_normalized)) return h
The question remains: how to determine the best bin size to digitize the signal? I've assumed the bin size should probably be the tick, and that the number of bins should therefore be variable (max(return)-min(return))/tick size. However, if the number of bins is variable, can the return value be comparable from one time to another (since max and min are likely variable)?
Anyone has a view on this?