Search code examples
design-patternsprediction

A suitable method to predict next binary outcome based on the patterns of past binary data


I have a series of binary data ( W and L values which are trade results of a trading platform) and I need to be able to predict the next value (Whether W or L) based on the past patterns. What would be the best method to accomplish this in Matlab o python.

I have already tried a basic pattern matching algorithm developed by my self. What I do there is get an input sequence of 5 outcomes and match it with all past data to get a probability of the 6th outcome. However the accuracy of that method is close to 30% which is not suitable for my prediction. That is a very basic method, I'm sure there must be other machine learning methods which would give more accurate results.

Basically What I need is, I have a past data sequence [ W, L, W , W , L , W ......up to 4300 points ] like this. And my system generates new data feeds like this [ W , L, L ,W ...] what I need is to predict the value of the next data, by matching the patterns of my current data feed to the past 4300 data points.


Solution

  • You can try using Markov Chains (I suggest you to start here):

    Or you can try another approach training a neural network, and then using it to predict (i.e. using LSTM):

    Or you can try CPT Model: https://github.com/analyticsvidhya/CPT, so the algorithm can predict the next value based in the new data feed. Read more about it here:

    You should periodically (based on the range of normal fluctuations in the market, for example weekly) retrain the chosen model.