Good day, everyone!
I have a problem where I have to program something like this:
I have some arbitrary number of events, let's call then Event A, B, C, D, E, F, ... and so on.
Now they occur in well defined sequences, just like below:
[A, A, C, A, A, A, F, B, A]
That's just a random sample, I have a data of thousands of such event sequences, and there are going to be 9 events in every sequence.
What I'm trying to do is to calculate the probability of each individual event happening. Like:
- what's the probability of event A occurring first
- what's the probability of event B occurring, given that the previous event was A
- what's the probability of event C occurring, given that the previous two events were A and B
So far I've gone through the maths behind conditional/joint probabilities, markov chains, but I can't get to come up with the programming part. Are there any leads to where I can get my hands on some framework, library, or a tool which will help me run the simulation with all of my sequences, and give any finalised probabilities?
P.S: For those who are aware of MLB, I'm just trying to find the probabilities of certain scores being made in all the 9 innings based on past scores. If I calculate the simple probability of a score being made, I get a very high probability of zero, which is not the case. I only have the data for the box scores.