MLE errors
tsabata opened this issue · comments
I have found two errors in function maximum likelihood estimation:
hmm = hmms.DtHMM.random(2,5)
states, seq = hmm.generate(1000);
hmm.maximum_likelihood_estimation(states, seq)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "hmms/dthmm.pyx", line 332, in hmms.dthmm.DtHMM.maximum_likelihood_estimation (hmms/dthmm.c:11523)
File "hmms/dthmm.pyx", line 352, in hmms.dthmm.DtHMM.maximum_likelihood_estimation (hmms/dthmm.c:10930)
TypeError: Cannot convert numpy.int64 to numpy.ndarray
This can be fixed using it in following way (which is not too intuitive).
hmm = hmms.DtHMM.random(2,5)
states, seq = hmm.generate(1000);
hmm.maximum_likelihood_estimation(numpy.ndarray(states), numpy.ndarray(seq))
The second problem appears when the sequence is too long.
ValueError: sequence too large; cannot be greater than 32
Hello,
for the input of the Baum-Welch algorithm functions and MLE function can be for now only two dimensional numpy array or list of one dimensional numpy arrays.
So you can use it like this:
hmm = hmms.DtHMM.random(2,5)
states, seq = hmm.generate( 1000 );
hmm.maximum_likelihood_estimation( [states], [seq] )
or use the function generate_data directly:
hmm = hmms.DtHMM.random(2,5)
states, seq = hmm.generate_data( ( 1,1000 ) );
hmm.maximum_likelihood_estimation(states, seq)
We will consider supporting one dimensional arrays later in development.
Thank you for your feedback!
best,
Lukas