Take for example a walk such as:
["school", "work", "home", "kindergarten", "home", "school", ...]
# or simply
[1, 2, 3, 4, 3, 1, ...]
What's the correct way of computing its entropy?
My current approach is to just count how many times each unique step is taken, compute the step-probabilities by normalizing, and then plug that into the Shannon entropy equation. Here's a small Python example:
import numpy as np
from collections import Counter
def time_correlated_entropy(walk):
counter = Counter(zip(walk[:-1], walk[1:]))
P = np.array(counter.values(), float) / np.sum(counter.values())
return - sum(P * np.log2(P))
It gives sensible results, but I have no idea whether this is the right way, because I have no literature to hold it up against.