From 32469e04617552736017df2f09c93ef89bd7c375 Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Fri, 5 Sep 2014 12:40:00 +0100 Subject: [PATCH 1/8] [testing] updated tests wrt normalization --- GPy/testing/model_tests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/GPy/testing/model_tests.py b/GPy/testing/model_tests.py index 451ab757..af4b12e2 100644 --- a/GPy/testing/model_tests.py +++ b/GPy/testing/model_tests.py @@ -19,9 +19,10 @@ class MiscTests(unittest.TestCase): k = GPy.kern.RBF(1) m = GPy.models.GPRegression(self.X, self.Y, kernel=k) m.randomize() - Kinv = np.linalg.pinv(k.K(self.X) + np.eye(self.N)*m.Gaussian_noise.variance) + m.likelihood.variance = .5 + Kinv = np.linalg.pinv(k.K(self.X) + np.eye(self.N)*m.likelihood.variance) K_hat = k.K(self.X_new) - k.K(self.X_new, self.X).dot(Kinv).dot(k.K(self.X, self.X_new)) - mu_hat = k.K(self.X_new, self.X).dot(Kinv).dot(self.Y) + mu_hat = k.K(self.X_new, self.X).dot(Kinv).dot(m.Y_normalized) mu, covar = m._raw_predict(self.X_new, full_cov=True) self.assertEquals(mu.shape, (self.N_new, self.D)) @@ -431,6 +432,8 @@ class GradientTests(np.testing.TestCase): k1 = GPy.kern.RBF(1) # + GPy.kern.White(1) k2 = GPy.kern.RBF(1) # + GPy.kern.White(1) Y = np.random.randn(N1, N2) + Y = Y-Y.mean(0) + Y = Y/Y.std(0) m = GPy.models.GPKroneckerGaussianRegression(X1, X2, Y, k1, k2) # build the model the dumb way From 9a74a933f3a57bcc0ea105cde63289f249c0541b Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Fri, 5 Sep 2014 12:40:20 +0100 Subject: [PATCH 2/8] [updates] made updates a function --- GPy/core/parameterization/param.py | 2 +- GPy/core/parameterization/parameter_core.py | 56 ++++++++++++++------- GPy/testing/parameterized_tests.py | 6 +++ 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/GPy/core/parameterization/param.py b/GPy/core/parameterization/param.py index 20ffd5db..7212c658 100644 --- a/GPy/core/parameterization/param.py +++ b/GPy/core/parameterization/param.py @@ -249,7 +249,7 @@ class Param(Parameterizable, ObsAr): try: indices = np.indices(self._realshape_, dtype=int) indices = indices[(slice(None),)+slice_index] - indices = np.rollaxis(indices, 0, indices.ndim).reshape(-1,2) + indices = np.rollaxis(indices, 0, indices.ndim).reshape(-1,self._realndim_) #print indices_ #if not np.all(indices==indices__): # import ipdb; ipdb.set_trace() diff --git a/GPy/core/parameterization/parameter_core.py b/GPy/core/parameterization/parameter_core.py index 82c494b2..c851e5d8 100644 --- a/GPy/core/parameterization/parameter_core.py +++ b/GPy/core/parameterization/parameter_core.py @@ -50,30 +50,50 @@ class Observable(object): as an observer. Every time the observable changes, it sends a notification with self as only argument to all its observers. """ - _updates = True def __init__(self, *args, **kwargs): super(Observable, self).__init__() from lists_and_dicts import ObserverList self.observers = ObserverList() + self._updates = True - @property - def updates(self): + def updates(self, updates=None): + """ + Get or set, whether automatic updates are performed. When updates are + off, the model might be in a non-working state. To make the model work + turn updates on again. + + :param bool|None updates: + + bool: whether to do updates + None: get the current update state + """ + if updates is None: + p = getattr(self, '_highest_parent_', None) + if p is not None: + self._updates = p._updates + return self._updates + assert isinstance(updates, bool), "updates are either on (True) or off (False)" p = getattr(self, '_highest_parent_', None) if p is not None: - self._updates = p._updates - return self._updates - - @updates.setter - def updates(self, ups): - assert isinstance(ups, bool), "updates are either on (True) or off (False)" - p = getattr(self, '_highest_parent_', None) - if p is not None: - p._updates = ups + p._updates = updates else: - self._updates = ups - if ups: - self._trigger_params_changed() + self._updates = updates + self.update_model() + + def toggle_updates(self): + self.updates(not self.updates()) + def update_model(self): + """ + Update the model from the current state. + Make sure that updates are on, otherwise this + method will do nothing + """ + if not self.updates(): + #print "Warning: updates are off, updating the model will do nothing" + return + self._trigger_params_changed() + def add_observer(self, observer, callble, priority=0): """ Add an observer `observer` with the callback `callble` @@ -110,7 +130,7 @@ class Observable(object): :param min_priority: only notify observers with priority > min_priority if min_priority is None, notify all observers in order """ - if not self.updates: + if not self.updates(): return if which is None: which = self @@ -798,7 +818,7 @@ class OptimizationHandlable(Indexable): """ # first take care of all parameters (from N(0,1)) x = rand_gen(size=self._size_transformed(), *args, **kwargs) - self.updates = False # Switch off the updates + self.updates(False) # Switch off the updates self.optimizer_array = x # makes sure all of the tied parameters get the same init (since there's only one prior object...) # now draw from prior where possible x = self.param_array.copy() @@ -806,7 +826,7 @@ class OptimizationHandlable(Indexable): unfixlist = np.ones((self.size,),dtype=np.bool) unfixlist[self.constraints[__fixed__]] = False self.param_array[unfixlist] = x[unfixlist] - self.updates = True + self.updates(True) #=========================================================================== # For shared memory arrays. This does nothing in Param, but sets the memory diff --git a/GPy/testing/parameterized_tests.py b/GPy/testing/parameterized_tests.py index c647c6eb..a96ac64d 100644 --- a/GPy/testing/parameterized_tests.py +++ b/GPy/testing/parameterized_tests.py @@ -152,6 +152,12 @@ class ParameterizedTest(unittest.TestCase): self.test1.kern.randomize() self.assertEqual(val, self.rbf.variance) + def test_updates(self): + self.test1.updates = False + val = float(self.rbf.variance) + self.test1.kern.randomize() + self.assertEqual(val, self.rbf.variance) + def test_fixing_optimize(self): self.testmodel.kern.lengthscale.fix() val = float(self.testmodel.kern.lengthscale) From 470c0dcfe605067f912a802f916f58e99f9d866b Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Fri, 5 Sep 2014 12:52:38 +0100 Subject: [PATCH 3/8] [updates] made updates a function, update_model(True|False|None) --- GPy/core/parameterization/parameter_core.py | 28 +++++++++++++-------- GPy/testing/parameterized_tests.py | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/GPy/core/parameterization/parameter_core.py b/GPy/core/parameterization/parameter_core.py index c851e5d8..6a62ab4c 100644 --- a/GPy/core/parameterization/parameter_core.py +++ b/GPy/core/parameterization/parameter_core.py @@ -50,13 +50,21 @@ class Observable(object): as an observer. Every time the observable changes, it sends a notification with self as only argument to all its observers. """ + _updates = True def __init__(self, *args, **kwargs): super(Observable, self).__init__() from lists_and_dicts import ObserverList self.observers = ObserverList() - self._updates = True - def updates(self, updates=None): + @property + def updates(self): + raise DeprecationWarning("updates is now a function, see update(True|False|None)") + + @updates.setter + def updates(self, ups): + raise DeprecationWarning("updates is now a function, see update(True|False|None)") + + def update_model(self, updates=None): """ Get or set, whether automatic updates are performed. When updates are off, the model might be in a non-working state. To make the model work @@ -78,18 +86,18 @@ class Observable(object): p._updates = updates else: self._updates = updates - self.update_model() + self.trigger_update() - def toggle_updates(self): - self.updates(not self.updates()) + def toggle_update(self): + self.update_model(not self.update()) - def update_model(self): + def trigger_update(self): """ Update the model from the current state. Make sure that updates are on, otherwise this method will do nothing """ - if not self.updates(): + if not self.update_model(): #print "Warning: updates are off, updating the model will do nothing" return self._trigger_params_changed() @@ -130,7 +138,7 @@ class Observable(object): :param min_priority: only notify observers with priority > min_priority if min_priority is None, notify all observers in order """ - if not self.updates(): + if not self.update_model(): return if which is None: which = self @@ -818,7 +826,7 @@ class OptimizationHandlable(Indexable): """ # first take care of all parameters (from N(0,1)) x = rand_gen(size=self._size_transformed(), *args, **kwargs) - self.updates(False) # Switch off the updates + self.update_model(False) # Switch off the updates self.optimizer_array = x # makes sure all of the tied parameters get the same init (since there's only one prior object...) # now draw from prior where possible x = self.param_array.copy() @@ -826,7 +834,7 @@ class OptimizationHandlable(Indexable): unfixlist = np.ones((self.size,),dtype=np.bool) unfixlist[self.constraints[__fixed__]] = False self.param_array[unfixlist] = x[unfixlist] - self.updates(True) + self.update_model(True) #=========================================================================== # For shared memory arrays. This does nothing in Param, but sets the memory diff --git a/GPy/testing/parameterized_tests.py b/GPy/testing/parameterized_tests.py index a96ac64d..f8895b14 100644 --- a/GPy/testing/parameterized_tests.py +++ b/GPy/testing/parameterized_tests.py @@ -153,7 +153,7 @@ class ParameterizedTest(unittest.TestCase): self.assertEqual(val, self.rbf.variance) def test_updates(self): - self.test1.updates = False + self.test1.update_model(False) val = float(self.rbf.variance) self.test1.kern.randomize() self.assertEqual(val, self.rbf.variance) From 3fff0448be46910fc7324bd58900639473fd5bcf Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Fri, 5 Sep 2014 14:17:00 +0100 Subject: [PATCH 4/8] [ard plotting] adjustments to the filtering --- GPy/kern/_src/linear.py | 2 +- GPy/plotting/matplot_dep/kernel_plots.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GPy/kern/_src/linear.py b/GPy/kern/_src/linear.py index 9fdacdbb..c30e344e 100644 --- a/GPy/kern/_src/linear.py +++ b/GPy/kern/_src/linear.py @@ -103,7 +103,7 @@ class Linear(Kern): def gradients_X_diag(self, dL_dKdiag, X): return 2.*self.variances*dL_dKdiag[:,None]*X - def input_sensitivity(self): + def input_sensitivity(self, summarize=True): return np.ones(self.input_dim) * self.variances #---------------------------------------# diff --git a/GPy/plotting/matplot_dep/kernel_plots.py b/GPy/plotting/matplot_dep/kernel_plots.py index db43f147..f2082db0 100644 --- a/GPy/plotting/matplot_dep/kernel_plots.py +++ b/GPy/plotting/matplot_dep/kernel_plots.py @@ -72,11 +72,11 @@ def plot_ARD(kernel, fignum=None, ax=None, title='', legend=False, filtering=Non x = np.arange(kernel.input_dim) - if order is None: - order = kernel.parameter_names(recursive=False) + if filtering is None: + filtering = kernel.parameter_names(recursive=False) for i in range(ard_params.shape[0]): - if kernel.parameters[i].name in order: + if kernel.parameters[i].name in filtering: c = Tango.nextMedium() bars.append(plot_bars(fig, ax, x, ard_params[i,:], c, kernel.parameters[i].name, bottom=bottom)) last_bottom = ard_params[i,:] From 68fa8b63663c30d1fa913e5bcb2a68bea0e246dd Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Fri, 5 Sep 2014 14:18:37 +0100 Subject: [PATCH 5/8] minor updates to the docs --- doc/GPy.core.parameterization.rst | 102 ++++++++++++ doc/GPy.core.rst | 61 +++---- doc/GPy.examples.rst | 16 ++ ...Py.inference.latent_function_inference.rst | 94 +++++++++++ doc/GPy.inference.optimization.rst | 78 +++++++++ doc/GPy.inference.rst | 54 +------ doc/GPy.kern.rst | 27 ---- doc/GPy.likelihoods.rst | 113 ++++++++++--- doc/GPy.mappings.rst | 16 ++ doc/GPy.models.rst | 64 +++++++- ...atent_space_visualizations.controllers.rst | 30 ++++ ...atplot_dep.latent_space_visualizations.rst | 17 ++ doc/GPy.plotting.matplot_dep.rst | 141 +++++++++++++++++ doc/GPy.plotting.rst | 17 ++ doc/GPy.rst | 1 + doc/GPy.testing.rst | 98 +++++------- doc/GPy.util.rst | 149 +++++++++++++++--- doc/tuto_creating_new_models.rst | 5 +- doc/tuto_interacting_with_models.rst | 31 ++-- 19 files changed, 865 insertions(+), 249 deletions(-) create mode 100644 doc/GPy.core.parameterization.rst create mode 100644 doc/GPy.inference.latent_function_inference.rst create mode 100644 doc/GPy.inference.optimization.rst create mode 100644 doc/GPy.plotting.matplot_dep.latent_space_visualizations.controllers.rst create mode 100644 doc/GPy.plotting.matplot_dep.latent_space_visualizations.rst create mode 100644 doc/GPy.plotting.matplot_dep.rst create mode 100644 doc/GPy.plotting.rst diff --git a/doc/GPy.core.parameterization.rst b/doc/GPy.core.parameterization.rst new file mode 100644 index 00000000..4877a06d --- /dev/null +++ b/doc/GPy.core.parameterization.rst @@ -0,0 +1,102 @@ +GPy.core.parameterization package +================================= + +Submodules +---------- + +GPy.core.parameterization.domains module +---------------------------------------- + +.. automodule:: GPy.core.parameterization.domains + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.index_operations module +------------------------------------------------- + +.. automodule:: GPy.core.parameterization.index_operations + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.lists_and_dicts module +------------------------------------------------ + +.. automodule:: GPy.core.parameterization.lists_and_dicts + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.observable_array module +------------------------------------------------- + +.. automodule:: GPy.core.parameterization.observable_array + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.param module +-------------------------------------- + +.. automodule:: GPy.core.parameterization.param + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.parameter_core module +----------------------------------------------- + +.. automodule:: GPy.core.parameterization.parameter_core + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.parameterized module +---------------------------------------------- + +.. automodule:: GPy.core.parameterization.parameterized + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.priors module +--------------------------------------- + +.. automodule:: GPy.core.parameterization.priors + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.ties_and_remappings module +---------------------------------------------------- + +.. automodule:: GPy.core.parameterization.ties_and_remappings + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.transformations module +------------------------------------------------ + +.. automodule:: GPy.core.parameterization.transformations + :members: + :undoc-members: + :show-inheritance: + +GPy.core.parameterization.variational module +-------------------------------------------- + +.. automodule:: GPy.core.parameterization.variational + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: GPy.core.parameterization + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/GPy.core.rst b/doc/GPy.core.rst index c4f1849d..3c236612 100644 --- a/doc/GPy.core.rst +++ b/doc/GPy.core.rst @@ -1,25 +1,16 @@ GPy.core package ================ +Subpackages +----------- + +.. toctree:: + + GPy.core.parameterization + Submodules ---------- -GPy.core.domains module ------------------------ - -.. automodule:: GPy.core.domains - :members: - :undoc-members: - :show-inheritance: - -GPy.core.fitc module --------------------- - -.. automodule:: GPy.core.fitc - :members: - :undoc-members: - :show-inheritance: - GPy.core.gp module ------------------ @@ -28,14 +19,6 @@ GPy.core.gp module :undoc-members: :show-inheritance: -GPy.core.gp_base module ------------------------ - -.. automodule:: GPy.core.gp_base - :members: - :undoc-members: - :show-inheritance: - GPy.core.mapping module ----------------------- @@ -52,22 +35,6 @@ GPy.core.model module :undoc-members: :show-inheritance: -GPy.core.parameterized module ------------------------------ - -.. automodule:: GPy.core.parameterized - :members: - :undoc-members: - :show-inheritance: - -GPy.core.priors module ----------------------- - -.. automodule:: GPy.core.priors - :members: - :undoc-members: - :show-inheritance: - GPy.core.sparse_gp module ------------------------- @@ -76,6 +43,14 @@ GPy.core.sparse_gp module :undoc-members: :show-inheritance: +GPy.core.sparse_gp_mpi module +----------------------------- + +.. automodule:: GPy.core.sparse_gp_mpi + :members: + :undoc-members: + :show-inheritance: + GPy.core.svigp module --------------------- @@ -84,10 +59,10 @@ GPy.core.svigp module :undoc-members: :show-inheritance: -GPy.core.transformations module -------------------------------- +GPy.core.symbolic module +------------------------ -.. automodule:: GPy.core.transformations +.. automodule:: GPy.core.symbolic :members: :undoc-members: :show-inheritance: diff --git a/doc/GPy.examples.rst b/doc/GPy.examples.rst index 4fd3528f..7fc8a123 100644 --- a/doc/GPy.examples.rst +++ b/doc/GPy.examples.rst @@ -12,6 +12,14 @@ GPy.examples.classification module :undoc-members: :show-inheritance: +GPy.examples.coreg_example module +--------------------------------- + +.. automodule:: GPy.examples.coreg_example + :members: + :undoc-members: + :show-inheritance: + GPy.examples.dimensionality_reduction module -------------------------------------------- @@ -20,6 +28,14 @@ GPy.examples.dimensionality_reduction module :undoc-members: :show-inheritance: +GPy.examples.non_gaussian module +-------------------------------- + +.. automodule:: GPy.examples.non_gaussian + :members: + :undoc-members: + :show-inheritance: + GPy.examples.regression module ------------------------------ diff --git a/doc/GPy.inference.latent_function_inference.rst b/doc/GPy.inference.latent_function_inference.rst new file mode 100644 index 00000000..c47da33a --- /dev/null +++ b/doc/GPy.inference.latent_function_inference.rst @@ -0,0 +1,94 @@ +GPy.inference.latent_function_inference package +=============================================== + +Submodules +---------- + +GPy.inference.latent_function_inference.dtc module +-------------------------------------------------- + +.. automodule:: GPy.inference.latent_function_inference.dtc + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.exact_gaussian_inference module +----------------------------------------------------------------------- + +.. automodule:: GPy.inference.latent_function_inference.exact_gaussian_inference + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.expectation_propagation module +---------------------------------------------------------------------- + +.. automodule:: GPy.inference.latent_function_inference.expectation_propagation + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.expectation_propagation_dtc module +-------------------------------------------------------------------------- + +.. automodule:: GPy.inference.latent_function_inference.expectation_propagation_dtc + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.fitc module +--------------------------------------------------- + +.. automodule:: GPy.inference.latent_function_inference.fitc + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.laplace module +------------------------------------------------------ + +.. automodule:: GPy.inference.latent_function_inference.laplace + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.posterior module +-------------------------------------------------------- + +.. automodule:: GPy.inference.latent_function_inference.posterior + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.var_dtc module +------------------------------------------------------ + +.. automodule:: GPy.inference.latent_function_inference.var_dtc + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.var_dtc_gpu module +---------------------------------------------------------- + +.. automodule:: GPy.inference.latent_function_inference.var_dtc_gpu + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.latent_function_inference.var_dtc_parallel module +--------------------------------------------------------------- + +.. automodule:: GPy.inference.latent_function_inference.var_dtc_parallel + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: GPy.inference.latent_function_inference + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/GPy.inference.optimization.rst b/doc/GPy.inference.optimization.rst new file mode 100644 index 00000000..83339202 --- /dev/null +++ b/doc/GPy.inference.optimization.rst @@ -0,0 +1,78 @@ +GPy.inference.optimization package +================================== + +Submodules +---------- + +GPy.inference.optimization.BayesOpt module +------------------------------------------ + +.. automodule:: GPy.inference.optimization.BayesOpt + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.optimization.conjugate_gradient_descent module +------------------------------------------------------------ + +.. automodule:: GPy.inference.optimization.conjugate_gradient_descent + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.optimization.gradient_descent_update_rules module +--------------------------------------------------------------- + +.. automodule:: GPy.inference.optimization.gradient_descent_update_rules + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.optimization.hmc module +------------------------------------- + +.. automodule:: GPy.inference.optimization.hmc + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.optimization.optimization module +---------------------------------------------- + +.. automodule:: GPy.inference.optimization.optimization + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.optimization.samplers module +------------------------------------------ + +.. automodule:: GPy.inference.optimization.samplers + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.optimization.scg module +------------------------------------- + +.. automodule:: GPy.inference.optimization.scg + :members: + :undoc-members: + :show-inheritance: + +GPy.inference.optimization.sgd module +------------------------------------- + +.. automodule:: GPy.inference.optimization.sgd + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: GPy.inference.optimization + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/GPy.inference.rst b/doc/GPy.inference.rst index 28f42994..2aa7839f 100644 --- a/doc/GPy.inference.rst +++ b/doc/GPy.inference.rst @@ -1,57 +1,13 @@ GPy.inference package ===================== -Submodules ----------- +Subpackages +----------- -GPy.inference.conjugate_gradient_descent module ------------------------------------------------ - -.. automodule:: GPy.inference.conjugate_gradient_descent - :members: - :undoc-members: - :show-inheritance: - -GPy.inference.gradient_descent_update_rules module --------------------------------------------------- - -.. automodule:: GPy.inference.gradient_descent_update_rules - :members: - :undoc-members: - :show-inheritance: - -GPy.inference.optimization module ---------------------------------- - -.. automodule:: GPy.inference.optimization - :members: - :undoc-members: - :show-inheritance: - -GPy.inference.samplers module ------------------------------ - -.. automodule:: GPy.inference.samplers - :members: - :undoc-members: - :show-inheritance: - -GPy.inference.scg module ------------------------- - -.. automodule:: GPy.inference.scg - :members: - :undoc-members: - :show-inheritance: - -GPy.inference.sgd module ------------------------- - -.. automodule:: GPy.inference.sgd - :members: - :undoc-members: - :show-inheritance: +.. toctree:: + GPy.inference.latent_function_inference + GPy.inference.optimization Module contents --------------- diff --git a/doc/GPy.kern.rst b/doc/GPy.kern.rst index b4b9d9aa..9ee59ed6 100644 --- a/doc/GPy.kern.rst +++ b/doc/GPy.kern.rst @@ -1,33 +1,6 @@ GPy.kern package ================ -Subpackages ------------ - -.. toctree:: - - GPy.kern.parts - -Submodules ----------- - -GPy.kern.constructors module ----------------------------- - -.. automodule:: GPy.kern.constructors - :members: - :undoc-members: - :show-inheritance: - -GPy.kern.kern module --------------------- - -.. automodule:: GPy.kern.kern - :members: - :undoc-members: - :show-inheritance: - - Module contents --------------- diff --git a/doc/GPy.likelihoods.rst b/doc/GPy.likelihoods.rst index c3da2650..70679454 100644 --- a/doc/GPy.likelihoods.rst +++ b/doc/GPy.likelihoods.rst @@ -1,28 +1,29 @@ GPy.likelihoods package ======================= -Subpackages ------------ - -.. toctree:: - - GPy.likelihoods.noise_models - Submodules ---------- -GPy.likelihoods.ep module -------------------------- +GPy.likelihoods.bernoulli module +-------------------------------- -.. automodule:: GPy.likelihoods.ep +.. automodule:: GPy.likelihoods.bernoulli :members: :undoc-members: :show-inheritance: -GPy.likelihoods.ep_mixed_noise module -------------------------------------- +GPy.likelihoods.exponential module +---------------------------------- -.. automodule:: GPy.likelihoods.ep_mixed_noise +.. automodule:: GPy.likelihoods.exponential + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.gamma module +---------------------------- + +.. automodule:: GPy.likelihoods.gamma :members: :undoc-members: :show-inheritance: @@ -35,14 +36,6 @@ GPy.likelihoods.gaussian module :undoc-members: :show-inheritance: -GPy.likelihoods.gaussian_mixed_noise module -------------------------------------------- - -.. automodule:: GPy.likelihoods.gaussian_mixed_noise - :members: - :undoc-members: - :show-inheritance: - GPy.likelihoods.likelihood module --------------------------------- @@ -51,10 +44,82 @@ GPy.likelihoods.likelihood module :undoc-members: :show-inheritance: -GPy.likelihoods.noise_model_constructors module ------------------------------------------------ +GPy.likelihoods.link_functions module +------------------------------------- -.. automodule:: GPy.likelihoods.noise_model_constructors +.. automodule:: GPy.likelihoods.link_functions + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.mixed_noise module +---------------------------------- + +.. automodule:: GPy.likelihoods.mixed_noise + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.negative_binomial module +---------------------------------------- + +.. automodule:: GPy.likelihoods.negative_binomial + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.ordinal module +------------------------------ + +.. automodule:: GPy.likelihoods.ordinal + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.poisson module +------------------------------ + +.. automodule:: GPy.likelihoods.poisson + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.skew_exponential module +--------------------------------------- + +.. automodule:: GPy.likelihoods.skew_exponential + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.skew_normal module +---------------------------------- + +.. automodule:: GPy.likelihoods.skew_normal + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.sstudent_t module +--------------------------------- + +.. automodule:: GPy.likelihoods.sstudent_t + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.student_t module +-------------------------------- + +.. automodule:: GPy.likelihoods.student_t + :members: + :undoc-members: + :show-inheritance: + +GPy.likelihoods.symbolic module +------------------------------- + +.. automodule:: GPy.likelihoods.symbolic :members: :undoc-members: :show-inheritance: diff --git a/doc/GPy.mappings.rst b/doc/GPy.mappings.rst index c48cb06e..e5d89872 100644 --- a/doc/GPy.mappings.rst +++ b/doc/GPy.mappings.rst @@ -4,6 +4,14 @@ GPy.mappings package Submodules ---------- +GPy.mappings.additive module +---------------------------- + +.. automodule:: GPy.mappings.additive + :members: + :undoc-members: + :show-inheritance: + GPy.mappings.kernel module -------------------------- @@ -28,6 +36,14 @@ GPy.mappings.mlp module :undoc-members: :show-inheritance: +GPy.mappings.symbolic module +---------------------------- + +.. automodule:: GPy.mappings.symbolic + :members: + :undoc-members: + :show-inheritance: + Module contents --------------- diff --git a/doc/GPy.models.rst b/doc/GPy.models.rst index 4440513e..5ee7e3a9 100644 --- a/doc/GPy.models.rst +++ b/doc/GPy.models.rst @@ -20,14 +20,6 @@ GPy.models.bcgplvm module :undoc-members: :show-inheritance: -GPy.models.fitc_classification module -------------------------------------- - -.. automodule:: GPy.models.fitc_classification - :members: - :undoc-members: - :show-inheritance: - GPy.models.gp_classification module ----------------------------------- @@ -36,6 +28,30 @@ GPy.models.gp_classification module :undoc-members: :show-inheritance: +GPy.models.gp_coregionalized_regression module +---------------------------------------------- + +.. automodule:: GPy.models.gp_coregionalized_regression + :members: + :undoc-members: + :show-inheritance: + +GPy.models.gp_heteroscedastic_regression module +----------------------------------------------- + +.. automodule:: GPy.models.gp_heteroscedastic_regression + :members: + :undoc-members: + :show-inheritance: + +GPy.models.gp_kronecker_gaussian_regression module +-------------------------------------------------- + +.. automodule:: GPy.models.gp_kronecker_gaussian_regression + :members: + :undoc-members: + :show-inheritance: + GPy.models.gp_multioutput_regression module ------------------------------------------- @@ -52,6 +68,14 @@ GPy.models.gp_regression module :undoc-members: :show-inheritance: +GPy.models.gp_var_gauss module +------------------------------ + +.. automodule:: GPy.models.gp_var_gauss + :members: + :undoc-members: + :show-inheritance: + GPy.models.gplvm module ----------------------- @@ -84,6 +108,14 @@ GPy.models.sparse_gp_classification module :undoc-members: :show-inheritance: +GPy.models.sparse_gp_coregionalized_regression module +----------------------------------------------------- + +.. automodule:: GPy.models.sparse_gp_coregionalized_regression + :members: + :undoc-members: + :show-inheritance: + GPy.models.sparse_gp_multioutput_regression module -------------------------------------------------- @@ -108,6 +140,22 @@ GPy.models.sparse_gplvm module :undoc-members: :show-inheritance: +GPy.models.ss_gplvm module +-------------------------- + +.. automodule:: GPy.models.ss_gplvm + :members: + :undoc-members: + :show-inheritance: + +GPy.models.ss_mrd module +------------------------ + +.. automodule:: GPy.models.ss_mrd + :members: + :undoc-members: + :show-inheritance: + GPy.models.svigp_regression module ---------------------------------- diff --git a/doc/GPy.plotting.matplot_dep.latent_space_visualizations.controllers.rst b/doc/GPy.plotting.matplot_dep.latent_space_visualizations.controllers.rst new file mode 100644 index 00000000..71826ed6 --- /dev/null +++ b/doc/GPy.plotting.matplot_dep.latent_space_visualizations.controllers.rst @@ -0,0 +1,30 @@ +GPy.plotting.matplot_dep.latent_space_visualizations.controllers package +======================================================================== + +Submodules +---------- + +GPy.plotting.matplot_dep.latent_space_visualizations.controllers.axis_event_controller module +--------------------------------------------------------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.latent_space_visualizations.controllers.axis_event_controller + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.latent_space_visualizations.controllers.imshow_controller module +----------------------------------------------------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.latent_space_visualizations.controllers.imshow_controller + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: GPy.plotting.matplot_dep.latent_space_visualizations.controllers + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/GPy.plotting.matplot_dep.latent_space_visualizations.rst b/doc/GPy.plotting.matplot_dep.latent_space_visualizations.rst new file mode 100644 index 00000000..6e5cf4bd --- /dev/null +++ b/doc/GPy.plotting.matplot_dep.latent_space_visualizations.rst @@ -0,0 +1,17 @@ +GPy.plotting.matplot_dep.latent_space_visualizations package +============================================================ + +Subpackages +----------- + +.. toctree:: + + GPy.plotting.matplot_dep.latent_space_visualizations.controllers + +Module contents +--------------- + +.. automodule:: GPy.plotting.matplot_dep.latent_space_visualizations + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/GPy.plotting.matplot_dep.rst b/doc/GPy.plotting.matplot_dep.rst new file mode 100644 index 00000000..77780708 --- /dev/null +++ b/doc/GPy.plotting.matplot_dep.rst @@ -0,0 +1,141 @@ +GPy.plotting.matplot_dep package +================================ + +Subpackages +----------- + +.. toctree:: + + GPy.plotting.matplot_dep.latent_space_visualizations + +Submodules +---------- + +GPy.plotting.matplot_dep.Tango module +------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.Tango + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.base_plots module +------------------------------------------ + +.. automodule:: GPy.plotting.matplot_dep.base_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.dim_reduction_plots module +--------------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.dim_reduction_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.img_plots module +----------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.img_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.inference_plots module +----------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.inference_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.kernel_plots module +-------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.kernel_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.mapping_plots module +--------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.mapping_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.maps module +------------------------------------ + +.. automodule:: GPy.plotting.matplot_dep.maps + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.models_plots module +-------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.models_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.netpbmfile module +------------------------------------------ + +.. automodule:: GPy.plotting.matplot_dep.netpbmfile + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.priors_plots module +-------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.priors_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.ssgplvm module +--------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.ssgplvm + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.svig_plots module +------------------------------------------ + +.. automodule:: GPy.plotting.matplot_dep.svig_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.variational_plots module +------------------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.variational_plots + :members: + :undoc-members: + :show-inheritance: + +GPy.plotting.matplot_dep.visualize module +----------------------------------------- + +.. automodule:: GPy.plotting.matplot_dep.visualize + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: GPy.plotting.matplot_dep + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/GPy.plotting.rst b/doc/GPy.plotting.rst new file mode 100644 index 00000000..af035515 --- /dev/null +++ b/doc/GPy.plotting.rst @@ -0,0 +1,17 @@ +GPy.plotting package +==================== + +Subpackages +----------- + +.. toctree:: + + GPy.plotting.matplot_dep + +Module contents +--------------- + +.. automodule:: GPy.plotting + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/GPy.rst b/doc/GPy.rst index 60092e91..9be6dbec 100644 --- a/doc/GPy.rst +++ b/doc/GPy.rst @@ -13,6 +13,7 @@ Subpackages GPy.likelihoods GPy.mappings GPy.models + GPy.plotting GPy.testing GPy.util diff --git a/doc/GPy.testing.rst b/doc/GPy.testing.rst index bd5258b7..2d1132d7 100644 --- a/doc/GPy.testing.rst +++ b/doc/GPy.testing.rst @@ -4,22 +4,6 @@ GPy.testing package Submodules ---------- -GPy.testing.bgplvm_tests module -------------------------------- - -.. automodule:: GPy.testing.bgplvm_tests - :members: - :undoc-members: - :show-inheritance: - -GPy.testing.cgd_tests module ----------------------------- - -.. automodule:: GPy.testing.cgd_tests - :members: - :undoc-members: - :show-inheritance: - GPy.testing.examples_tests module --------------------------------- @@ -28,10 +12,18 @@ GPy.testing.examples_tests module :undoc-members: :show-inheritance: -GPy.testing.gplvm_tests module ------------------------------- +GPy.testing.fitc module +----------------------- -.. automodule:: GPy.testing.gplvm_tests +.. automodule:: GPy.testing.fitc + :members: + :undoc-members: + :show-inheritance: + +GPy.testing.index_operations_tests module +----------------------------------------- + +.. automodule:: GPy.testing.index_operations_tests :members: :undoc-members: :show-inheritance: @@ -44,18 +36,42 @@ GPy.testing.kernel_tests module :undoc-members: :show-inheritance: -GPy.testing.mapping_tests module --------------------------------- +GPy.testing.likelihood_tests module +----------------------------------- -.. automodule:: GPy.testing.mapping_tests +.. automodule:: GPy.testing.likelihood_tests :members: :undoc-members: :show-inheritance: -GPy.testing.mrd_tests module ----------------------------- +GPy.testing.model_tests module +------------------------------ -.. automodule:: GPy.testing.mrd_tests +.. automodule:: GPy.testing.model_tests + :members: + :undoc-members: + :show-inheritance: + +GPy.testing.observable_tests module +----------------------------------- + +.. automodule:: GPy.testing.observable_tests + :members: + :undoc-members: + :show-inheritance: + +GPy.testing.parameterized_tests module +-------------------------------------- + +.. automodule:: GPy.testing.parameterized_tests + :members: + :undoc-members: + :show-inheritance: + +GPy.testing.pickle_tests module +------------------------------- + +.. automodule:: GPy.testing.pickle_tests :members: :undoc-members: :show-inheritance: @@ -68,38 +84,6 @@ GPy.testing.prior_tests module :undoc-members: :show-inheritance: -GPy.testing.psi_stat_expectation_tests module ---------------------------------------------- - -.. automodule:: GPy.testing.psi_stat_expectation_tests - :members: - :undoc-members: - :show-inheritance: - -GPy.testing.psi_stat_gradient_tests module ------------------------------------------- - -.. automodule:: GPy.testing.psi_stat_gradient_tests - :members: - :undoc-members: - :show-inheritance: - -GPy.testing.sparse_gplvm_tests module -------------------------------------- - -.. automodule:: GPy.testing.sparse_gplvm_tests - :members: - :undoc-members: - :show-inheritance: - -GPy.testing.unit_tests module ------------------------------ - -.. automodule:: GPy.testing.unit_tests - :members: - :undoc-members: - :show-inheritance: - Module contents --------------- diff --git a/doc/GPy.util.rst b/doc/GPy.util.rst index c86280a7..14c7643b 100644 --- a/doc/GPy.util.rst +++ b/doc/GPy.util.rst @@ -1,20 +1,21 @@ GPy.util package ================ -Subpackages ------------ - -.. toctree:: - - GPy.util.latent_space_visualizations - Submodules ---------- -GPy.util.Tango module ---------------------- +GPy.util.block_matrices module +------------------------------ -.. automodule:: GPy.util.Tango +.. automodule:: GPy.util.block_matrices + :members: + :undoc-members: + :show-inheritance: + +GPy.util.caching module +----------------------- + +.. automodule:: GPy.util.caching :members: :undoc-members: :show-inheritance: @@ -27,6 +28,14 @@ GPy.util.classification module :undoc-members: :show-inheritance: +GPy.util.config module +---------------------- + +.. automodule:: GPy.util.config + :members: + :undoc-members: + :show-inheritance: + GPy.util.datasets module ------------------------ @@ -35,6 +44,14 @@ GPy.util.datasets module :undoc-members: :show-inheritance: +GPy.util.debug module +--------------------- + +.. automodule:: GPy.util.debug + :members: + :undoc-members: + :show-inheritance: + GPy.util.decorators module -------------------------- @@ -43,6 +60,46 @@ GPy.util.decorators module :undoc-members: :show-inheritance: +GPy.util.diag module +-------------------- + +.. automodule:: GPy.util.diag + :members: + :undoc-members: + :show-inheritance: + +GPy.util.erfcx module +--------------------- + +.. automodule:: GPy.util.erfcx + :members: + :undoc-members: + :show-inheritance: + +GPy.util.functions module +------------------------- + +.. automodule:: GPy.util.functions + :members: + :undoc-members: + :show-inheritance: + +GPy.util.gpu_init module +------------------------ + +.. automodule:: GPy.util.gpu_init + :members: + :undoc-members: + :show-inheritance: + +GPy.util.initialization module +------------------------------ + +.. automodule:: GPy.util.initialization + :members: + :undoc-members: + :show-inheritance: + GPy.util.linalg module ---------------------- @@ -51,6 +108,22 @@ GPy.util.linalg module :undoc-members: :show-inheritance: +GPy.util.linalg_gpu module +-------------------------- + +.. automodule:: GPy.util.linalg_gpu + :members: + :undoc-members: + :show-inheritance: + +GPy.util.ln_diff_erfs module +---------------------------- + +.. automodule:: GPy.util.ln_diff_erfs + :members: + :undoc-members: + :show-inheritance: + GPy.util.misc module -------------------- @@ -67,6 +140,14 @@ GPy.util.mocap module :undoc-members: :show-inheritance: +GPy.util.mpi module +------------------- + +.. automodule:: GPy.util.mpi + :members: + :undoc-members: + :show-inheritance: + GPy.util.multioutput module --------------------------- @@ -75,18 +156,34 @@ GPy.util.multioutput module :undoc-members: :show-inheritance: -GPy.util.plot module --------------------- +GPy.util.netpbmfile module +-------------------------- -.. automodule:: GPy.util.plot +.. automodule:: GPy.util.netpbmfile :members: :undoc-members: :show-inheritance: -GPy.util.plot_latent module ---------------------------- +GPy.util.normalizer module +-------------------------- -.. automodule:: GPy.util.plot_latent +.. automodule:: GPy.util.normalizer + :members: + :undoc-members: + :show-inheritance: + +GPy.util.parallel module +------------------------ + +.. automodule:: GPy.util.parallel + :members: + :undoc-members: + :show-inheritance: + +GPy.util.pca module +------------------- + +.. automodule:: GPy.util.pca :members: :undoc-members: :show-inheritance: @@ -99,18 +196,26 @@ GPy.util.squashers module :undoc-members: :show-inheritance: -GPy.util.univariate_Gaussian module ------------------------------------ +GPy.util.subarray_and_sorting module +------------------------------------ -.. automodule:: GPy.util.univariate_Gaussian +.. automodule:: GPy.util.subarray_and_sorting :members: :undoc-members: :show-inheritance: -GPy.util.visualize module -------------------------- +GPy.util.symbolic module +------------------------ -.. automodule:: GPy.util.visualize +.. automodule:: GPy.util.symbolic + :members: + :undoc-members: + :show-inheritance: + +GPy.util.univariate_Gaussian module +----------------------------------- + +.. automodule:: GPy.util.univariate_Gaussian :members: :undoc-members: :show-inheritance: diff --git a/doc/tuto_creating_new_models.rst b/doc/tuto_creating_new_models.rst index 5c51cdad..c5196c33 100644 --- a/doc/tuto_creating_new_models.rst +++ b/doc/tuto_creating_new_models.rst @@ -39,8 +39,9 @@ Obligatory methods :py:meth:`~GPy.core.model.Model.parameters_changed` : Updates the internal state of the model and sets the gradient of each parameter handle in the hierarchy with respect to the - log_likelihod. Thus here we need to put the negative derivative of - the rosenbrock function: + log_likelihod. Thus here we need to set the negative derivative of + the rosenbrock function for the parameters. In this case it is the + gradient for self.X: self.X.gradient = -scipy.optimize.rosen_der(self.X) diff --git a/doc/tuto_interacting_with_models.rst b/doc/tuto_interacting_with_models.rst index 5bd0511e..27980665 100644 --- a/doc/tuto_interacting_with_models.rst +++ b/doc/tuto_interacting_with_models.rst @@ -40,24 +40,21 @@ is shown. For each parameter, the table contains the name of the parameter, the current value, and in case there are defined: constraints, ties and prior distrbutions associated. :: - Log-likelihood: 6.309e+02 + Name : sparse gp + Log-likelihood : -405.646051581 + Number of Parameters : 8 + Parameters: + sparse_gp. | Value | Constraint | Prior | Tied to + inducing inputs | (5, 1) | | | + rbf.variance | 1.0 | +ve | | + rbf.lengthscale | 1.0 | +ve | | + Gaussian_noise.variance | 1.0 | +ve | | + - Name | Value | Constraints | Ties | Prior - ------------------------------------------------------------------ - iip_0_0 | -1.4671 | | | - iip_1_0 | 2.6378 | | | - iip_2_0 | -0.0396 | | | - iip_3_0 | -2.6372 | | | - iip_4_0 | 1.4704 | | | - rbf_variance | 1.5672 | (+ve) | | - rbf_lengthscale | 2.5625 | (+ve) | | - white_variance | 0.0000 | (+ve) | | - noise_variance | 0.0022 | (+ve) | | - -In this case the kernel parameters (``rbf_variance``, -``rbf_lengthscale`` and ``white_variance``) as well as -the noise parameter (``noise_variance``), are constrained -to be positive, while the inducing inputs have not +In this case the kernel parameters (``rbf.variance``, +``rbf.lengthscale``) as well as +the likelihood noise parameter (``Gaussian_noise.variance``), are constrained +to be positive, while the inducing inputs have no constraints associated. Also there are no ties or prior defined. Setting and fetching parameters by name From 9978c285a226c058372d750cbb7846bef9244d88 Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Fri, 5 Sep 2014 14:20:26 +0100 Subject: [PATCH 6/8] [param] indexing routine simplified --- GPy/core/parameterization/param.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/GPy/core/parameterization/param.py b/GPy/core/parameterization/param.py index 7212c658..fb8adf4c 100644 --- a/GPy/core/parameterization/param.py +++ b/GPy/core/parameterization/param.py @@ -143,31 +143,6 @@ class Param(Parameterizable, ObsAr): return self._raveled_index() #=========================================================================== - # Index recreation - #=========================================================================== - def _expand_index(self, slice_index=None): - # this calculates the full indexing arrays from the slicing objects given by get_item for _real..._ attributes - # it basically translates slices to their respective index arrays and turns negative indices around - # it tells you in the second return argument if it has only seen arrays as indices - if slice_index is None: - slice_index = self._current_slice_ - def f(a): - a, b = a - if isinstance(a, numpy.ndarray) and a.dtype == bool: - raise ValueError, "Boolean indexing not implemented, use Param[np.where(index)] to index by boolean arrays!" - if a not in (slice(None), Ellipsis): - if isinstance(a, slice): - start, stop, step = a.indices(b) - return numpy.r_[start:stop:step] - elif isinstance(a, (list, numpy.ndarray, tuple)): - a = numpy.asarray(a, dtype=int) - a[a < 0] = b + a[a < 0] - elif a < 0: - a = b + a - return numpy.r_[a] - return numpy.r_[:b] - return itertools.imap(f, itertools.izip_longest(slice_index[:self._realndim_], self._realshape_, fillvalue=slice(self.size))) - #=========================================================================== # Constrainable #=========================================================================== def _ensure_fixes(self): From f048245a9c69f657c96cca22b1c7ca2af05e56b2 Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Fri, 5 Sep 2014 14:21:18 +0100 Subject: [PATCH 7/8] [parameter_core] empty space --- GPy/core/parameterization/parameter_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/core/parameterization/parameter_core.py b/GPy/core/parameterization/parameter_core.py index 6a62ab4c..2831eaf7 100644 --- a/GPy/core/parameterization/parameter_core.py +++ b/GPy/core/parameterization/parameter_core.py @@ -63,7 +63,7 @@ class Observable(object): @updates.setter def updates(self, ups): raise DeprecationWarning("updates is now a function, see update(True|False|None)") - + def update_model(self, updates=None): """ Get or set, whether automatic updates are performed. When updates are From a358c518293a6b48b9519650e47c9333767e24af Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Fri, 5 Sep 2014 14:21:34 +0100 Subject: [PATCH 8/8] [printing] added model details for printing --- GPy/core/model.py | 9 +++++++++ GPy/core/parameterization/parameterized.py | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/GPy/core/model.py b/GPy/core/model.py index 3863ac42..c4fc7fd5 100644 --- a/GPy/core/model.py +++ b/GPy/core/model.py @@ -372,4 +372,13 @@ class Model(Parameterized): self.optimizer_array = x return ret + def __str__(self): + model_details = [['Name', self.name], + ['Log-likelihood', '{}'.format(float(self.log_likelihood()))], + ["Number of Parameters", '{}'.format(self.size)]] + from operator import itemgetter + max_len = reduce(lambda a, b: max(len(b[0]), a), model_details, 0) + to_print = [""] + ["{0:{l}} : {1}".format(name, detail, l=max_len) for name, detail in model_details] + ["Parameters:"] + to_print.append(super(Model, self).__str__()) + return "\n".join(to_print) diff --git a/GPy/core/parameterization/parameterized.py b/GPy/core/parameterization/parameterized.py index e036d680..ba5cdf1a 100644 --- a/GPy/core/parameterization/parameterized.py +++ b/GPy/core/parameterization/parameterized.py @@ -350,7 +350,6 @@ class Parameterized(Parameterizable): def _ties_str(self): return [','.join(x._ties_str) for x in self.flattened_parameters] def __str__(self, header=True): - name = adjust_name_for_printing(self.name) + "." constrs = self._constraints_str; ts = self._ties_str @@ -365,11 +364,9 @@ class Parameterized(Parameterizable): to_print = [] for n, d, c, t, p in itertools.izip(names, desc, constrs, ts, prirs): to_print.append(format_spec.format(name=n, desc=d, const=c, t=t, pri=p)) - # to_print = [format_spec.format(p=p, const=c, t=t) if isinstance(p, Param) else p.__str__(header=False) for p, c, t in itertools.izip(self.parameters, constrs, ts)] sep = '-' * (nl + sl + cl + + pl + tl + 8 * 2 + 3) if header: header = " {{0:<{0}s}} | {{1:^{1}s}} | {{2:^{2}s}} | {{3:^{3}s}} | {{4:^{4}s}}".format(nl, sl, cl, pl, tl).format(name, "Value", "Constraint", "Prior", "Tied to") - # header += '\n' + sep to_print.insert(0, header) return '\n'.format(sep).join(to_print) pass