jmschrei / pomegranate

Fast, flexible and easy to use probabilistic modelling in Python.
http://pomegranate.readthedocs.org/en/latest/
MIT License
3.29k stars 591 forks source link

Wrong Markov Chain initial state distribution #1004

Closed angelo5d0 closed 1 year ago

angelo5d0 commented 1 year ago

Hello everybody!

Can anyone please explain me the initial state distribution resulting from .from_samples()?

Thank you!

import numpy as np
from pomegranate import *

np.random.seed(137)
seq_data = np.random.randint(0, 10, (1, 1000))

markov_chain = MarkovChain.from_samples(seq_data)

print(markov_chain.distributions[0])

n = seq_data.shape[0] * seq_data.shape[1]

for i in range(10):
    print(i, ':', len(np.where(seq_data == i)[0]) / n)

image

jmschrei commented 1 year ago

Thank you for opening an issue. pomegranate has recently been rewritten from the ground up to use PyTorch instead of Cython (v1.0.0), and so all issues are being closed as they are likely out of date. Please re-open or start a new issue if a related issue is still present in the new codebase.