#15711: DiscreteHiddenMarkovModel instances do not unpickle correctly
--------------------------+----------------------------
   Reporter:  ppurka      |            Owner:
       Type:  defect      |           Status:  new
   Priority:  major       |        Milestone:  sage-6.1
  Component:  statistics  |         Keywords:
  Merged in:              |          Authors:
  Reviewers:              |  Report Upstream:  N/A
Work issues:              |           Branch:
     Commit:              |     Dependencies:
   Stopgaps:              |
--------------------------+----------------------------
 From the [https://spreadsheets.google.com/pub?key=pCwvGVwSMxTzT6E2xNdo5fA
 google notebook bug reports]

 ''As you can see in the following script, even though an unpickled
 instance claims to be equal to the original, it behaves differently.
 Worse, several of the functions (e.g., M2.transition_matrix()) throw
 exceptions, and an exception is thrown if you just try to print the
 object's value. ''
 {{{
 sage: from sage.stats.hmm.hmm import DIscreteHiddenMarkovModel
 sage: M = DiscreteHiddenMarkovModel([[1.0]], [[0.1, 0.9]], [1.0])
 sage: import pickle
 sage: M2 = pickle.loads(pickle.dumps(M))
 sage: M2 == M
 True
 sage: M.log_likelihood([1]*4)
 -0.4214420626313051
 sage: M2.log_likelihood([1]*4)
 -inf
 sage: M2.emission_matrix()
 ---------------------------------------------------------------------------
 ValueError Traceback (most recent call last)
 <ipython-input-24-2ee08778d25e> in <module>()
 ----> 1 M2.emission_matrix()

 /opt/sage-5.12-linux-64bit-fedora_release_16_verne-
 x86_64-Linux/local/lib/python2.7/site-packages/sage/stats/hmm/hmm.so in
 sage.stats.hmm.hmm.DiscreteHiddenMarkovModel.emission_matrix
 (sage/stats/hmm/hmm.c:2760)()

 /opt/sage-5.12-linux-64bit-fedora_release_16_verne-
 x86_64-Linux/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc
 in _matrix_constructor(*args, **kwds)
 641 raise ValueError, "entries has the wrong length"
 642 elif len(args[0]) > 0:
 --> 643 raise ValueError, "entries has the wrong length"
 644
 645 entries = args[0]

 ValueError: entries has the wrong length

 sage: M2
 ---------------------------------------------------------------------------
 ValueError Traceback (most recent call last)
 <ipython-input-20-13669956a766> in <module>()
 ... (long trace deleted)
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15711>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to