mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-11 21:12:38 +02:00
pickling unified with __getstate__ and __setstate__
This commit is contained in:
parent
1e06ca2d40
commit
05e8e75c58
5 changed files with 35 additions and 13 deletions
|
|
@ -43,6 +43,28 @@ class kern(Parameterised):
|
|||
|
||||
Parameterised.__init__(self)
|
||||
|
||||
def __getstate__(self):
|
||||
"""
|
||||
Get the current state of the class,
|
||||
here just all the indices, rest can get recomputed
|
||||
"""
|
||||
return Parameterised.__getstate__(self) + [self.parts,
|
||||
self.Nparts,
|
||||
self.num_params,
|
||||
self.input_dim,
|
||||
self.input_slices,
|
||||
self.param_slices
|
||||
]
|
||||
|
||||
def __setstate__(self, state):
|
||||
self.param_slices = state.pop()
|
||||
self.input_slices = state.pop()
|
||||
self.input_dim = state.pop()
|
||||
self.num_params = state.pop()
|
||||
self.Nparts = state.pop()
|
||||
self.parts = state.pop()
|
||||
Parameterised.__setstate__(self, state)
|
||||
|
||||
|
||||
def plot_ARD(self, fignum=None, ax=None, title=None):
|
||||
"""If an ARD kernel is present, it bar-plots the ARD parameters"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue