chriscore / MarkovSharp

An easy to use C# implementation of an N-state Markov model.
89 stars 23 forks source link

HMM implementation #1

Closed ghost closed 7 years ago

ghost commented 7 years ago

support, I am newer HMM user, I have difficulties to implement

  1. insert observations of stock prices , and getting the most liklihood prediction on next step, of stock direction like: going to up more than 5% , going to go down more than 2%, and so on (about 4 states) how to set the data + learner to get correct results ?
chriscore commented 7 years ago

Hi ellLazar

I suppose that to do this would require an understanding of the factors and contributing metrics which influence stock movements, which I am not sure that I understand enough to comment on.

Given this insight, you would need to implement a new markov strategy, (create a class which extends from GenericMarkov) where your data is a sequence of class instances whose properties represent significant factors in stock movements (maybe this could be as simple as having properties on these instances for UnitStockPrice, maybe you would try to include influencing factors such as the price of related stocks or how many negative and positive tweets are matching related query terms etc).

An issue to consider is that a Markov model is a probabilistic state machine, and thus goes from one discrete state into another discrete state. This is important, because if a model is built from data where stock price is the only metric being considered, and over the course of a few days repeatedly goes from 10.1 to 50, 10.2 to 50, 10.3 to 50, 10.4 to 50 etc etc, these lower states (those being of value 10.x) are considered discrete and unrelated states, except for their shared commonality with the unit 50. To resolve this, you may wish to do some normalisation, or 'fuzzy' the matching against the internal model values (perhaps so that all values within a certain percent point of another are considered a potential match).

If you have any technical related issues, or questions specifically about this library I would be happy to assist.