pickling unified with __getstate__ and __setstate__

This commit is contained in:
Max Zwiessele 2013-06-25 18:01:18 +01:00
parent 1e06ca2d40
commit 05e8e75c58
5 changed files with 35 additions and 13 deletions

View file

@ -53,7 +53,7 @@ class BayesianGPLVM(SparseGP, GPLVM):
Get the current state of the class,
here just all the indices, rest can get recomputed
"""
return [self.init] + SparseGP.__getstate__(self)
return SparseGP.__getstate__(self) + [self.init]
def __setstate__(self, state):
self.init = state.pop()

View file

@ -85,7 +85,7 @@ class MRD(Model):
self.ensure_default_constraints()
def __getstate__(self):
return [self.names,
return Model.__getstate__(self) + [self.names,
self.bgplvms,
self.gref,
self.nparams,
@ -105,6 +105,7 @@ class MRD(Model):
self.gref = state.pop()
self.bgplvms = state.pop()
self.names = state.pop()
Model.__setstate__(self, state)
@property
def X(self):