mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-26 15:49:40 +02:00
pickling now allways binary as well as protocol -1
This commit is contained in:
parent
2aa78e5cfc
commit
be8dad89a6
2 changed files with 9 additions and 10 deletions
|
|
@ -31,14 +31,9 @@ class Parameterized(object):
|
||||||
# """ Override for which names to print out, when using print m """
|
# """ Override for which names to print out, when using print m """
|
||||||
# return self._get_param_names()
|
# return self._get_param_names()
|
||||||
|
|
||||||
def pickle(self, filename, protocol=None):
|
def pickle(self, filename, protocol=-1):
|
||||||
if protocol is None:
|
with open(filename, 'wb') as f:
|
||||||
if self._has_get_set_state():
|
cPickle.dump(self, f, protocol=protocol)
|
||||||
protocol = 0
|
|
||||||
else:
|
|
||||||
protocol = -1
|
|
||||||
with open(filename, 'w') as f:
|
|
||||||
cPickle.dump(self, f, protocol)
|
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
"""Returns a (deep) copy of the current model """
|
"""Returns a (deep) copy of the current model """
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,12 @@ class BufferedAxisChangedController(AxisChangedController):
|
||||||
raise NotImplementedError('update view given in here')
|
raise NotImplementedError('update view given in here')
|
||||||
|
|
||||||
def get_grid(self):
|
def get_grid(self):
|
||||||
xmin, xmax = self._compute_buffered(*self._x_lim)
|
if self._not_init:
|
||||||
ymin, ymax = self._compute_buffered(*self._y_lim)
|
xmin, xmax = self._compute_buffered(*self._x_lim)
|
||||||
|
ymin, ymax = self._compute_buffered(*self._y_lim)
|
||||||
|
else:
|
||||||
|
xmin, xmax = self._x_lim
|
||||||
|
ymin, ymax = self._y_lim
|
||||||
x, y = numpy.mgrid[xmin:xmax:1j * self.resolution, ymin:ymax:1j * self.resolution]
|
x, y = numpy.mgrid[xmin:xmax:1j * self.resolution, ymin:ymax:1j * self.resolution]
|
||||||
return numpy.hstack((x.flatten()[:, None], y.flatten()[:, None]))
|
return numpy.hstack((x.flatten()[:, None], y.flatten()[:, None]))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue