Given an input like this:
timestamp vars
2 [1,2,3]
2 [1,2,4]
3 [1,2]
4 [1,3]
5 [1,3]
I need to keep a rolling count of each of the indices. The tried expanding the array into a one hot encoding ([1,2,3,5] -> [0,1,1,1,0,1]) and adding but this can get arbitrarily big (> 1 million), so I want to maintain it as a dict. Something like below. Any pointers would be greatly appreciated.
timestamp vars
2 {1:1, 2:1, 3:1}
2 {1:2, 2:2, 3:1, 4:1}
3 {1:3, 2:3, 3:1, 4:1}
4 {1:4, 2:3, 3:2, 4:1}
5 {1:5, 2:3, 3:3, 4:1}
Thanks!