Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create MarkovChain Object from transition matrices #5

Closed
prof-amer opened this issue Apr 9, 2021 · 1 comment
Closed

Create MarkovChain Object from transition matrices #5

prof-amer opened this issue Apr 9, 2021 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@prof-amer
Copy link

I do know that to initiate the mc object, you need to input of the states sequence. It is possible to initiate if I were to supply the transition matrices instead?

@prof-amer prof-amer changed the title Create MarkovChain Object from transition matric Create MarkovChain Object from transition matrices Apr 9, 2021
@maximtrp
Copy link
Owner

Sure. You can create an instance of MarkovChain class and pass transition frequency and probability matrices to it:

import mchmm as mc
states = ['A', 'B', 'C']
# Transition frequency matrix
trans_freq_mat = np.random.randint(0, 10, (3, 3))
# Transition probability matrix
trans_prob_mat = np.nan_to_num(trans_freq_mat / trans_freq_mat.sum(axis=1)[:, None])
markov_chain = mc.MarkovChain(states=states, obs=trans_freq_mat, obs_p=trans_prob_mat)

Also, look at __init__ in documentation.

@maximtrp maximtrp added the question Further information is requested label Apr 10, 2021
@maximtrp maximtrp self-assigned this Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants