From ca03714331d429db106700878838085dbc8220c2 Mon Sep 17 00:00:00 2001 From: James McMurray Date: Thu, 4 Sep 2014 15:46:35 +0200 Subject: [PATCH 1/5] Added missing comma Added missing comma in the hstack call in _get_params. --- GPy/mappings/additive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/mappings/additive.py b/GPy/mappings/additive.py index fe352a83..5297982b 100644 --- a/GPy/mappings/additive.py +++ b/GPy/mappings/additive.py @@ -39,7 +39,7 @@ class Additive(Mapping): return self.mapping1._get_param_names + self.mapping2._get_param_names def _get_params(self): - return np.hstack((self.mapping1._get_params() self.mapping2._get_params())) + return np.hstack((self.mapping1._get_params(), self.mapping2._get_params())) def _set_params(self, x): self.mapping1._set_params(x[:self.mapping1.num_params]) From e49bef9b9486665ce3390835eced55b3964bddce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Zwie=C3=9Fele?= Date: Thu, 4 Sep 2014 17:30:06 +0100 Subject: [PATCH 2/5] [param] indexing fix, this can be memory intensive if millions of parameters --- GPy/core/parameterization/param.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/GPy/core/parameterization/param.py b/GPy/core/parameterization/param.py index d5822825..ff8cc638 100644 --- a/GPy/core/parameterization/param.py +++ b/GPy/core/parameterization/param.py @@ -246,24 +246,9 @@ class Param(Parameterizable, ObsAr): # get a int-array containing all indices in the first axis. if slice_index is None: slice_index = self._current_slice_ - if isinstance(slice_index, (tuple, list)): - clean_curr_slice = [s for s in slice_index if numpy.any(s != Ellipsis)] - for i in range(self._realndim_-len(clean_curr_slice)): - i+=1 - clean_curr_slice += [range(self._realshape_[i])] - if (all(isinstance(n, (numpy.ndarray, list, tuple)) for n in clean_curr_slice) - and len(set(map(len, clean_curr_slice))) <= 1): - return numpy.fromiter(itertools.izip(*clean_curr_slice), - dtype=[('', int)] * self._realndim_, count=len(clean_curr_slice[0])).view((int, self._realndim_)) - try: - expanded_index = list(self._expand_index(slice_index)) - indices = numpy.fromiter(itertools.product(*expanded_index), - dtype=[('', int)] * self._realndim_, count=reduce(lambda a, b: a * b.size, expanded_index, 1)).view((int, self._realndim_)) - except: - print "Warning: extended indexing was used" - indices = np.indices(self._realshape_, dtype=int) - indices = indices[(slice(None),)+slice_index] - indices = np.rollaxis(indices, 0, indices.ndim) + indices = np.indices(self._realshape_, dtype=int) + indices = indices[(slice(None),)+slice_index] + indices = np.rollaxis(indices, 0, indices.ndim) return indices def _max_len_names(self, gen, header): gen = map(lambda x: " ".join(map(str, x)), gen) From 4886dfde08218e1a013ff50b6adf6e8341d9c33c Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Thu, 4 Sep 2014 18:01:33 +0100 Subject: [PATCH 3/5] [indexing] maybe? cannot tell, tests are broken --- GPy/core/parameterization/param.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/GPy/core/parameterization/param.py b/GPy/core/parameterization/param.py index ff8cc638..eed18bea 100644 --- a/GPy/core/parameterization/param.py +++ b/GPy/core/parameterization/param.py @@ -246,9 +246,18 @@ class Param(Parameterizable, ObsAr): # get a int-array containing all indices in the first axis. if slice_index is None: slice_index = self._current_slice_ - indices = np.indices(self._realshape_, dtype=int) - indices = indices[(slice(None),)+slice_index] - indices = np.rollaxis(indices, 0, indices.ndim) + try: + indices = np.indices(self._realshape_, dtype=int) + indices = indices[(slice(None),)+slice_index] + indices = np.rollaxis(indices, 0, indices.ndim).reshape(-1,2) + #print indices_ + #if not np.all(indices==indices__): + # import ipdb; ipdb.set_trace() + except: + print "Warning: extended indexing was used" + indices = np.indices(self._realshape_, dtype=int) + indices = indices[(slice(None),)+slice_index] + indices = np.rollaxis(indices, 0, indices.ndim) return indices def _max_len_names(self, gen, header): gen = map(lambda x: " ".join(map(str, x)), gen) From d06f8b9272ddbf1892c0d9d800e9e9f3a8696fc0 Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Thu, 4 Sep 2014 18:02:34 +0100 Subject: [PATCH 4/5] [indexing] maybe? cannot tell, tests are broken --- GPy/core/parameterization/param.py | 1 - 1 file changed, 1 deletion(-) diff --git a/GPy/core/parameterization/param.py b/GPy/core/parameterization/param.py index eed18bea..20ffd5db 100644 --- a/GPy/core/parameterization/param.py +++ b/GPy/core/parameterization/param.py @@ -254,7 +254,6 @@ class Param(Parameterizable, ObsAr): #if not np.all(indices==indices__): # import ipdb; ipdb.set_trace() except: - print "Warning: extended indexing was used" indices = np.indices(self._realshape_, dtype=int) indices = indices[(slice(None),)+slice_index] indices = np.rollaxis(indices, 0, indices.ndim) From e0321c961afbd94ed7962646eafbb3ac026454c1 Mon Sep 17 00:00:00 2001 From: Zhenwen Dai Date: Fri, 5 Sep 2014 10:43:46 +0100 Subject: [PATCH 5/5] fix psicomp problem --- GPy/kern/_src/psi_comp/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GPy/kern/_src/psi_comp/__init__.py b/GPy/kern/_src/psi_comp/__init__.py index 7a5851fb..eced8392 100644 --- a/GPy/kern/_src/psi_comp/__init__.py +++ b/GPy/kern/_src/psi_comp/__init__.py @@ -29,6 +29,9 @@ class PSICOMP_RBF(Pickleable): else: raise ValueError, "unknown distriubtion received for psi-statistics" + def _setup_observers(self): + pass + class PSICOMP_Linear(Pickleable): @Cache_this(limit=2, ignore_args=(0,))