(Apologies if my use of terms is off - I am not a mathematician by trade and what I did learn way back was in a different language)
What I know: the total length of the stream, the body of possible events, the pop-count for each event, and the range of each event (essentially the index of the last instance of this event).
What I want: Given an incoming stream of events I am trying to predict what the next event is likely to be, i.e. calculate the probability of the next event being a particular one of the known population.
Example:
Let's say the incoming stream is
ABABCCCC (not known by the receiver)
Known by the receiver:
Length=8
Count Range
A: 2 3
B: 2 4
C: 4 8
Ignoring the range component we can trivially calculate the probability of each event by dividing its pop-count into the total message length:
Count Range Prob
A: 2 3 0.25
B: 2 4 0.25
C: 4 8 0.50
When looking at the range we can calculate the local probability of each event being next (by local I mean considering only the current event).
Count Range Local prob
A: 2 3 2/3 = 0.6666
B: 2 4 2/4 = 0.5
C: 4 8 4/8 = 0.5
But how do I combine the two types of probability into one value without enumerating all combinations and testing each one to see if it matches the constraints?
It's obvious from inspection that in this particular case the probability of the next event being a C is 0.0 here as having anything but A or B as the first event would prevent all of the As and Bs from occurring within their range, but it's not clear to me what the formal calculation should look like.
-
Some more context:
In the real scenario, number of unique events can run into the low thousands while the stream length can be up to a few billions while the million range will be more typical.
I can pre-calculate a few incoming events essentially for free so I want to pick the most probably one(s) for that in an attempt to save overall cost.
Events can come and go - one of the static events is Define New Event - I did not include this fact initially because it does not affect the issue at hand. Sometimes all live ranges will be so long that the individual ranges don't matter - I can just go with the straight probability based on pop-count alone, but every once in a while there'll be short bursts of events that are short-lived but whose probability will locally exceed those of the longer-lived, more populous events. Calculation does not have to be exact - if I can calculate a reasonable trend then that will definitely help.