Detecting whether there are "runs" of wins or losses in a game

68 Views Asked by At

So let's say I have a fishing robot.

It throws its line, and overall, from my measurements, there is a 50% chance it will catch a fish. If it does, we win and move to the next throw, if it doesn't, we lose and move on to the next throw.

This is very much like a coin flip game. However, the behavior of the fish makes this more complex.

There is a chance that there are actually "runs" of wins/losses, where after a few wins it's actually more likely that you'll make a catch, and to the opposite, after a few losses, it becomes more likely you'll lose again.

This does not happen with coin flipping games, but it might happen here with the fish.

This might be because there are "schooling"s of fish in the sea, and sometimes a lot of fish are where you are fishing, and sometimes none are.

I don't know if there are "runs" or not, that's what I want to figure out (programmatically).

If there are "runs" then it would make sense for me to adapt my fishing behavior/strategy to take this into account (would it?). But if there are no "runs" then that certainly would be a waste of time.

My question is: how do I figure out whether there are "runs" or not?

Is there a method and/or does this problem have a name in mathematics, that I could look up?

Let's say I have a big "table" of 1000 fishing attempts, each being a success or a failure, a win or a loss.

What algorithm or formula would I use to determine if there are "runs" in that table? What's the right technique to use to solve this problem?

And how big does my table need to be for results to make sense? I guess that'd be progressively more and more significant, but is there some measure of how significant I can obtain?

Any help would be greatly appreciated, I'm a robot engineer not a mathematician, but if I'm pointed in the right direction I might be able to figure this out. I'm not looking for a complete solution, just a hint/nudge in the right direction.

Thanks a lot in advance!

2

There are 2 best solutions below

0
On

One way would be to use machine learning(like LSTM). You could split the table into training and test datasets. You would use the training set to train and testing to find the accuracy. If the accuracy is around 50%, then you could say that it is likely that the data is random.

Another way(and one that is much simpler) is to find the probability of catching a single fish, assuming there were no other fish nearby. Then you could find a potential run, and raise the probability to the length of that run. If that power was below a set threshold, then you could say it is likely a run. This method with the threshold is more subjective.

0
On

If you want some quantitative estimates, assume that you have the Markov chain with two states "hot hand" and "cold hand" with probability $p$ to stay in the state and $q$ to switch from one state to another and having a catch when the hand is hot and no catch when it is cold (so $q<\frac 12$ means that there are streaks, but $q=1/2$ is the same as coin flips). Now the reasonable statistics to look at is just the number of switches from catch to no catch or back after $n+1$ attempts. The probability of an individual flip is $q$ which gives the mean of $nq$ and the variance of $npq$. Now, for this family of distributions, your "exceptional" family of events is being below $N$ ($N=1,2,\dots,n$) (if you want to check for streaks only rather than for both streaks and anti-steaks). You observe $m$ and determine the largest $q$ for which the probability that the normal variable with mean $nq$ and variance $npq$ is below $N$ is above your chosen threshold (usually 1% or 5%). If that $q$ is noticeably below $1/2$, then it is worth looking at the streaks. Otherwise pretty much forget it.

Of course, you can play with more complicated models as well, but the procedure is the same.