Chain.walk(start=0) chooses a random start state
rdbliss opened this issue · 1 comments
rdbliss commented
Calling Chain.walk()
with the parameter start=0
chooses a random start state from the chain.
MWE:
chain = pykov.Chain({(0, 1): 1, (1, 0): 1})
chain.walk(0, 0) # Repeat a few times to get a [1].
The relevant line is here:
if not start:
start = self.steady().choose()
This could be fixed by checking for start == None
and stop == None
, I think. If 0 is excluded by design, can a note be added to the documentation?
riccardoscalco commented
I think that it is bad code design and can be considered an issue. At the time I wrote pykov I was thinking mainly at states described by strings and I did not pay much attention to have a more generic codebase.
Can you please do a pull request? I'll be grateful to accept it.