Missing state in markov.chain_from_seq

Issue #45 closed
Pierre Denis repo owner created an issue

The markov.chain_from_seq function does not include the last state given in argument, should this state has not been encountered earlier. For instance,

from lea import markov
mc = markov.chain_from_seq("ABC")
print (mc.states)
# ->('A', 'B')

This may cause erroneous results in other markov.Chain methods. Actually, since there is no example of transition from this last state, a special treatment is required, which should be either raising an exception or giving arbitrary probabilities.

Analysis: if such case occurs, then the last state will be arbitrarily considered to be absorbing, i.e. the next state is itself with probability 1. This choice should be duly documented.

Comments (5)

  1. Log in to comment