From ba050dabfbb1795073ff9359cb427b3da200578c Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:02:58 +0200 Subject: [PATCH 01/33] new: added to_dict() method to Coregionalize kernel class --- GPy/kern/src/coregionalize.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/GPy/kern/src/coregionalize.py b/GPy/kern/src/coregionalize.py index d5111c3bf..41ddf8417 100644 --- a/GPy/kern/src/coregionalize.py +++ b/GPy/kern/src/coregionalize.py @@ -134,3 +134,18 @@ def gradients_X(self, dL_dK, X, X2=None): def gradients_X_diag(self, dL_dKdiag, X): return np.zeros(X.shape) + + def to_dict(self): + """ + Convert the object into a json serializable dictionary. + + Note: It uses the private method _save_to_input_dict of the parent. + + :return dict: json serializable dictionary containing the needed information to instantiate the object + """ + + input_dict = super(Coregionalize, self)._save_to_input_dict() + input_dict["class"] = "GPy.kern.Coregionalize" + input_dict["W"] = self.W.values.tolist() + input_dict["kappa"] = self.kappa.values.tolist() + return input_dict From fcb43ce5dd94af96b0e4bcc49755c8d848da9d59 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:03:31 +0200 Subject: [PATCH 02/33] new: added to_dict() method to MixedNoise likelihood class --- GPy/likelihoods/mixed_noise.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/GPy/likelihoods/mixed_noise.py b/GPy/likelihoods/mixed_noise.py index db230b134..67102b201 100644 --- a/GPy/likelihoods/mixed_noise.py +++ b/GPy/likelihoods/mixed_noise.py @@ -80,3 +80,22 @@ def samples(self, gp, Y_metadata): _ysim = np.array([np.random.normal(lik.gp_link.transf(gpj), scale=np.sqrt(lik.variance), size=1) for gpj in gp_filtered.flatten()]) Ysim[flt,:] = _ysim.reshape(n1,N2) return Ysim + + def to_dict(self): + """ + Convert the object into a json serializable dictionary. + + Note: It uses the private method _save_to_input_dict of the parent. + + :return dict: json serializable dictionary containing the needed information to instantiate the object + """ + + # input_dict = super(MixedNoise, self)._save_to_input_dict() + input_dict = {} + input_dict["name"] = self.name + input_dict["class"] = "GPy.likelihoods.MixedNoise" + input_dict["likelihood_list"] = {} + for ii in range(len(self.likelihoods_list)): + input_dict["likelihood_list"][ii] = self.likelihoods_list[ii].to_dict() + + return input_dict \ No newline at end of file From 4de3fdda20abcea2bba678c25eb802686ab47b70 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:05:24 +0200 Subject: [PATCH 03/33] fix: made Y_metadata dict content serializable --- GPy/core/gp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GPy/core/gp.py b/GPy/core/gp.py index 0704c6a6b..5adc8ce47 100644 --- a/GPy/core/gp.py +++ b/GPy/core/gp.py @@ -134,9 +134,10 @@ def to_dict(self, save_data=True): if self.mean_function is not None: input_dict["mean_function"] = self.mean_function.to_dict() input_dict["inference_method"] = self.inference_method.to_dict() - #FIXME: Assumes the Y_metadata is serializable. We should create a Metadata class + # TODO: We should create a Metadata class if self.Y_metadata is not None: - input_dict["Y_metadata"] = self.Y_metadata + # make Y_metadata serializable + input_dict["Y_metadata"] = {k: self.Y_metadata[k].tolist() for k in self.Y_metadata.keys()} if self.normalizer is not None: input_dict["normalizer"] = self.normalizer.to_dict() return input_dict From f79144bf474399ff6feb497424f9d944f878d5ce Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:06:04 +0200 Subject: [PATCH 04/33] fix: typo --- GPy/core/parameterization/variational.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/core/parameterization/variational.py b/GPy/core/parameterization/variational.py index 1dbd205b4..911c5b3ea 100644 --- a/GPy/core/parameterization/variational.py +++ b/GPy/core/parameterization/variational.py @@ -106,7 +106,7 @@ def __init__(self, means=None, variances=None, name='latent space', *a, **kw): self.link_parameters(self.mean, self.variance) self.num_data, self.input_dim = self.mean.shape if self.has_uncertain_inputs(): - assert self.variance.shape == self.mean.shape, "need one variance per sample and dimenion" + assert self.variance.shape == self.mean.shape, "need one variance per sample and dimension" def set_gradients(self, grad): self.mean.gradient, self.variance.gradient = grad From 4c3c2ac755cb5c0b4e93d93f1806ee2bc9f814f4 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Fri, 29 Oct 2021 13:32:16 +0200 Subject: [PATCH 05/33] added additional needed parameters to to_dict() method for Coregionalize kernel + added _build_from_input dict method --- GPy/kern/src/coregionalize.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/GPy/kern/src/coregionalize.py b/GPy/kern/src/coregionalize.py index 41ddf8417..d05f5c6ad 100644 --- a/GPy/kern/src/coregionalize.py +++ b/GPy/kern/src/coregionalize.py @@ -146,6 +146,16 @@ def to_dict(self): input_dict = super(Coregionalize, self)._save_to_input_dict() input_dict["class"] = "GPy.kern.Coregionalize" + # W and kappa must be serializable input_dict["W"] = self.W.values.tolist() input_dict["kappa"] = self.kappa.values.tolist() + input_dict["output_dim"] = self.output_dim return input_dict + + @staticmethod + def _build_from_input_dict(kernel_class, input_dict): + useGPU = input_dict.pop('useGPU', None) + # W and kappa must be converted back to numpy arrays + input_dict['W'] = np.array(input_dict['W']) + input_dict['kappa'] = np.array(input_dict['kappa']) + return Coregionalize(**input_dict) From 49e272c4493e38fcccef77d3730659891a37f96e Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Fri, 29 Oct 2021 13:33:01 +0200 Subject: [PATCH 06/33] new: added possibility to build MixedNoise likelihood from input_dict --- GPy/likelihoods/mixed_noise.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/GPy/likelihoods/mixed_noise.py b/GPy/likelihoods/mixed_noise.py index 67102b201..50289e446 100644 --- a/GPy/likelihoods/mixed_noise.py +++ b/GPy/likelihoods/mixed_noise.py @@ -91,11 +91,21 @@ def to_dict(self): """ # input_dict = super(MixedNoise, self)._save_to_input_dict() - input_dict = {} - input_dict["name"] = self.name - input_dict["class"] = "GPy.likelihoods.MixedNoise" - input_dict["likelihood_list"] = {} + input_dict = {"name": self.name, + "class": "GPy.likelihoods.MixedNoise", + "likelihoods_list": []} for ii in range(len(self.likelihoods_list)): - input_dict["likelihood_list"][ii] = self.likelihoods_list[ii].to_dict() - - return input_dict \ No newline at end of file + input_dict["likelihoods_list"].append(self.likelihoods_list[ii].to_dict()) + + return input_dict + + @staticmethod + def _build_from_input_dict(likelihood_class, input_dict): + import copy + input_dict = copy.deepcopy(input_dict) + # gp_link_dict = input_dict.pop('gp_link_dict') + # import GPy + # gp_link = GPy.likelihoods.link_functions.GPTransformation.from_dict(gp_link_dict) + # input_dict["gp_link"] = gp_link + input_dict['likelihoods_list'] = [Likelihood.from_dict(l) for l in input_dict['likelihoods_list']] + return likelihood_class(**input_dict) From a133947b424cbe4f057f816eb387db96d5f8d424 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Fri, 29 Oct 2021 13:35:13 +0200 Subject: [PATCH 07/33] Y_metadata conversion from serializable to np.array when loading from dict --- GPy/core/gp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GPy/core/gp.py b/GPy/core/gp.py index 5adc8ce47..62fd43b74 100644 --- a/GPy/core/gp.py +++ b/GPy/core/gp.py @@ -163,9 +163,10 @@ def _format_input_dict(input_dict, data=None): input_dict["mean_function"] = mean_function input_dict["inference_method"] = GPy.inference.latent_function_inference.LatentFunctionInference.from_dict(input_dict["inference_method"]) - #FIXME: Assumes the Y_metadata is serializable. We should create a Metadata class - Y_metadata = input_dict.get("Y_metadata") - input_dict["Y_metadata"] = Y_metadata + # converts Y_metadata from serializable to array. We should create a Metadata class + # Y_metadata = input_dict.get("Y_metadata") + # input_dict["Y_metadata"] = Y_metadata + input_dict["Y_metadata"] = {k: np.array(input_dict['Y_metadata'][k]) for k in input_dict['Y_metadata'].keys()} normalizer = input_dict.get("normalizer") if normalizer is not None: From 1b8b649878705d76cc23166cddf3009869a23ef7 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Fri, 29 Oct 2021 14:04:20 +0200 Subject: [PATCH 08/33] fix: rework Y_metadata part for compatibility with unittests !minor --- GPy/core/gp.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/GPy/core/gp.py b/GPy/core/gp.py index 62fd43b74..3cfa38ec3 100644 --- a/GPy/core/gp.py +++ b/GPy/core/gp.py @@ -164,9 +164,11 @@ def _format_input_dict(input_dict, data=None): input_dict["inference_method"] = GPy.inference.latent_function_inference.LatentFunctionInference.from_dict(input_dict["inference_method"]) # converts Y_metadata from serializable to array. We should create a Metadata class - # Y_metadata = input_dict.get("Y_metadata") - # input_dict["Y_metadata"] = Y_metadata - input_dict["Y_metadata"] = {k: np.array(input_dict['Y_metadata'][k]) for k in input_dict['Y_metadata'].keys()} + Y_metadata = input_dict.get("Y_metadata") + if isinstance(Y_metadata, dict): + input_dict["Y_metadata"] = {k: np.array(Y_metadata[k]) for k in Y_metadata.keys()} + else: + input_dict["Y_metadata"] = Y_metadata normalizer = input_dict.get("normalizer") if normalizer is not None: From f4409e0f15b8997bd2ed882c1292e339802ebb64 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 24 Nov 2021 13:48:51 +0100 Subject: [PATCH 09/33] conda cleanup in appveyors pipeline --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index f5faee5cc..085186c38 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,6 +22,7 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" + - conda clean --packages - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a From 67a481385e52039a0e25776f3a2bcbcccc7c7f2a Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 24 Nov 2021 14:10:49 +0100 Subject: [PATCH 10/33] conda clean up after conda update --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 085186c38..8554cb546 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,9 +22,9 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - - conda clean --packages - conda config --set always_yes yes --set changeps1 no - conda update -q conda + - conda clean --packages - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" - activate build-environment From 73960b40579eb2e3f0ca28a399ddf5816d8f17c7 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 24 Nov 2021 18:14:19 +0100 Subject: [PATCH 11/33] conda clean before conda update --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8554cb546..a4a248290 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,8 +23,8 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no - - conda update -q conda - conda clean --packages + - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" - activate build-environment From 7f4ce5f4e59620e7a4159fcc923ef941e7a02252 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 08:49:30 +0100 Subject: [PATCH 12/33] try pinning packages for conda --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index a4a248290..d029e05c3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,6 +23,7 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no + - conda config --add pinned_packages defaults::conda - conda clean --packages - conda update -q conda - conda info -a From 4567ddfb0bf40e4c581b087105c0a4895574c911 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 09:10:23 +0100 Subject: [PATCH 13/33] revert all conda changes --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d029e05c3..f5faee5cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,8 +23,6 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no - - conda config --add pinned_packages defaults::conda - - conda clean --packages - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" From 5f0271776fedcdcf768f5b632825bc1e631207e9 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 09:45:46 +0100 Subject: [PATCH 14/33] conda clean all (not only packages) --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index f5faee5cc..1f2b2501d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,6 +23,7 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no + - conda clean --all - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" From cd783a111313ad20b359580017e2a5ef58f6832b Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 10:38:38 +0100 Subject: [PATCH 15/33] use conda update anaconda --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1f2b2501d..782e75f90 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,8 +23,8 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no - - conda clean --all - - conda update -q conda + - conda update anaconda +# - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" - activate build-environment From 9c9dfb23e037f860242799e34847d6ea37a475ba Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 10:58:54 +0100 Subject: [PATCH 16/33] pin conda package --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 782e75f90..63074f123 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,9 +22,9 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - - conda config --set always_yes yes --set changeps1 no - - conda update anaconda -# - conda update -q conda + - conda config --set always_yes yes --set changeps1 no --add pinned_packages defaults::conda + - conda clean --all + - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" - activate build-environment From 289a15c8c539ce897a4dfeef383bd283ce094914 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 11:02:34 +0100 Subject: [PATCH 17/33] pin conda package --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 63074f123..18ff37a56 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,7 +22,8 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - - conda config --set always_yes yes --set changeps1 no --add pinned_packages defaults::conda + - conda config --set always_yes yes --set changeps1 no + - conda config --add pinned_packages defaults::conda - conda clean --all - conda update -q conda - conda info -a From 4d9f9e8276922f9d85f25a2d5f7939800d39abf8 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 11:18:25 +0100 Subject: [PATCH 18/33] try installing charset-normalizer beforehand --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 18ff37a56..39433a900 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,8 +23,7 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no - - conda config --add pinned_packages defaults::conda - - conda clean --all + - conda install charset-normalizer - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" From 517108a0665e8ace346a5a7d3ad39143fa654261 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 11:25:28 +0100 Subject: [PATCH 19/33] try to get from conda-forge --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 39433a900..85f5ef9c2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,7 +23,7 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no - - conda install charset-normalizer + - conda config --prepend channels conda-forge - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" From 0dc988b4ba38b7bc8f7cdedf9cfc44cee98f7349 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 25 Nov 2021 11:35:50 +0100 Subject: [PATCH 20/33] revert all conda changes --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 85f5ef9c2..f5faee5cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,7 +23,6 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no - - conda config --prepend channels conda-forge - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" From cd6e9b58e806a6c432ceefeac88b10bd129e1c75 Mon Sep 17 00:00:00 2001 From: Peter Paul Kiefer Date: Thu, 25 Nov 2021 18:49:55 +0100 Subject: [PATCH 21/33] Try to fix the conda update challange. See: https://community.intel.com/t5/Intel-Distribution-for-Python/Conda-update-Conda-fails/td-p/1126174 It is just a try for a different context/(conda version). --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index f5faee5cc..451fa4f40 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,6 +23,7 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no + - conda install charset-normalizer -f - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" From 9c0c1676923a5086ed684dc6928b0e751d73839d Mon Sep 17 00:00:00 2001 From: Peter Paul Kiefer Date: Thu, 25 Nov 2021 19:24:52 +0100 Subject: [PATCH 22/33] Still fixing build error on appveyor I also use a newer miniconda version for greater python versions. --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 451fa4f40..261e50f05 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,11 +10,11 @@ environment: - PYTHON_VERSION: 3.6 MINICONDA: C:\Miniconda36-x64 - PYTHON_VERSION: 3.7 - MINICONDA: C:\Miniconda36-x64 + MINICONDA: C:\Miniconda37-x64 - PYTHON_VERSION: 3.8 - MINICONDA: C:\Miniconda36-x64 + MINICONDA: C:\Miniconda38-x64 - PYTHON_VERSION: 3.9 - MINICONDA: C:\Miniconda36-x64 + MINICONDA: C:\Miniconda38-x64 #configuration: # - Debug From 62f88ff0f19b527ee80c9ddf82c6ec4d0d448ddc Mon Sep 17 00:00:00 2001 From: Peter Paul Kiefer Date: Thu, 25 Nov 2021 19:33:07 +0100 Subject: [PATCH 23/33] Update appveyor.yml Thinking it over it decided to use miniconda38 for all python versions unless python 3.5. --- appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 261e50f05..e69bb64e4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,9 +8,9 @@ environment: - PYTHON_VERSION: 3.5 MINICONDA: C:\Miniconda35-x64 - PYTHON_VERSION: 3.6 - MINICONDA: C:\Miniconda36-x64 + MINICONDA: C:\Miniconda38-x64 - PYTHON_VERSION: 3.7 - MINICONDA: C:\Miniconda37-x64 + MINICONDA: C:\Miniconda38-x64 - PYTHON_VERSION: 3.8 MINICONDA: C:\Miniconda38-x64 - PYTHON_VERSION: 3.9 @@ -23,7 +23,6 @@ environment: install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set changeps1 no - - conda install charset-normalizer -f - conda update -q conda - conda info -a - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" From 77ea10b752b74ed8e382f9c14bdad98e2dfd764f Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Fri, 26 Nov 2021 09:19:57 +0100 Subject: [PATCH 24/33] revert miniconda versioning changes --- appveyor.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e69bb64e4..f5faee5cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,13 +8,13 @@ environment: - PYTHON_VERSION: 3.5 MINICONDA: C:\Miniconda35-x64 - PYTHON_VERSION: 3.6 - MINICONDA: C:\Miniconda38-x64 + MINICONDA: C:\Miniconda36-x64 - PYTHON_VERSION: 3.7 - MINICONDA: C:\Miniconda38-x64 + MINICONDA: C:\Miniconda36-x64 - PYTHON_VERSION: 3.8 - MINICONDA: C:\Miniconda38-x64 + MINICONDA: C:\Miniconda36-x64 - PYTHON_VERSION: 3.9 - MINICONDA: C:\Miniconda38-x64 + MINICONDA: C:\Miniconda36-x64 #configuration: # - Debug From c84d968f2a7dce2ef44315b6b9f024f05bc07b08 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Fri, 26 Nov 2021 09:20:24 +0100 Subject: [PATCH 25/33] adjust GPy version in appveyor.yml --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f5faee5cc..b62f8b7d8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ environment: secure: 8/ZjXFwtd1S7ixd7PJOpptupKKEDhm2da/q3unabJ00= COVERALLS_REPO_TOKEN: secure: d3Luic/ESkGaWnZrvWZTKrzO+xaVwJWaRCEP0F+K/9DQGPSRZsJ/Du5g3s4XF+tS - gpy_version: 1.9.9 + gpy_version: 1.10.0 matrix: - PYTHON_VERSION: 3.5 MINICONDA: C:\Miniconda35-x64 From a63306423df5886270d40903454bdbce028a73a3 Mon Sep 17 00:00:00 2001 From: Peter Paul Kiefer Date: Sat, 27 Nov 2021 16:03:10 +0100 Subject: [PATCH 26/33] 1st attempt bring the appveyor build to life again --- appveyor.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f5faee5cc..dd89a2c47 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,13 +8,13 @@ environment: - PYTHON_VERSION: 3.5 MINICONDA: C:\Miniconda35-x64 - PYTHON_VERSION: 3.6 - MINICONDA: C:\Miniconda36-x64 + MINICONDA: C:\Miniconda3-x64 - PYTHON_VERSION: 3.7 - MINICONDA: C:\Miniconda36-x64 + MINICONDA: C:\Miniconda3-x64 - PYTHON_VERSION: 3.8 - MINICONDA: C:\Miniconda36-x64 + MINICONDA: C:\Miniconda3-x64 - PYTHON_VERSION: 3.9 - MINICONDA: C:\Miniconda36-x64 + MINICONDA: C:\Miniconda3-x64 #configuration: # - Debug From 299b3b023ac209f1fb449f1927eca1f0c4225b1d Mon Sep 17 00:00:00 2001 From: Peter Paul Kiefer Date: Sun, 28 Nov 2021 10:00:24 +0100 Subject: [PATCH 27/33] #955 fixing ci build on appveyor After bringing the miniconda env to work again, the wrong matplotlib version was used. This commit should fix that. --- appveyor.yml | 3 ++- setup.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dd89a2c47..4768a3fa9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,7 +25,8 @@ install: - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a - - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib" +# github issue #955: freez build versions of numpy, scipy and matplotlib + - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy=1.19.2 scipy=1.5.2 matplotlib=3.3.4" - activate build-environment # We need wheel installed to build wheels - python -m pip install wheel diff --git a/setup.py b/setup.py index 73bfc0356..261a7c908 100644 --- a/setup.py +++ b/setup.py @@ -117,11 +117,13 @@ def ismac(): except ModuleNotFoundError: ext_mods = [] -install_requirements = ['numpy>=1.7', 'six', 'paramz>=0.9.0', 'cython>=0.29'] +# #955 +install_requirements = ['numpy==1.19.2', 'six', 'paramz>=0.9.0', 'cython>=0.29'] if sys.version_info < (3, 6): install_requirements += ['scipy>=1.3.0,<1.5.0'] else: - install_requirements += ['scipy>=1.3.0'] + # #955 + install_requirements += ['scipy==1.5.2'] setup(name = 'GPy', version = __version__, @@ -168,13 +170,15 @@ def ismac(): include_package_data = True, py_modules = ['GPy.__init__'], test_suite = 'GPy.testing', - setup_requires = ['numpy>=1.7'], + # #955 + setup_requires = ['numpy == 1.19.2'], install_requires = install_requirements, extras_require = {'docs':['sphinx'], 'optional':['mpi4py', 'ipython>=4.0.0', ], - 'plotting':['matplotlib >= 3.0', + #matplotlib Version see github issue #955 + 'plotting':['matplotlib == 3.3.4', 'plotly >= 1.8.6'], 'notebook':['jupyter_client >= 4.0.6', 'ipywidgets >= 4.0.3', From a93c4ace5f884db4f55e0faffd9f3287d5e86f35 Mon Sep 17 00:00:00 2001 From: Peter Paul Kiefer Date: Sun, 28 Nov 2021 10:25:18 +0100 Subject: [PATCH 28/33] #955 Fix CI build Freezing numpy and scipy was a bad idea. I freeze matplotlib dependend on the python version only. --- appveyor.yml | 9 +++++++-- setup.py | 13 ++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4768a3fa9..6bf3333cf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,14 +7,19 @@ environment: matrix: - PYTHON_VERSION: 3.5 MINICONDA: C:\Miniconda35-x64 + MPL_VERSION: 3.0.0 - PYTHON_VERSION: 3.6 MINICONDA: C:\Miniconda3-x64 + MPL_VERSION: 3.3.4 - PYTHON_VERSION: 3.7 MINICONDA: C:\Miniconda3-x64 + MPL_VERSION: 3.3.4 - PYTHON_VERSION: 3.8 MINICONDA: C:\Miniconda3-x64 + MPL_VERSION: 3.3.4 - PYTHON_VERSION: 3.9 MINICONDA: C:\Miniconda3-x64 + MPL_VERSION: 3.3.4 #configuration: # - Debug @@ -25,8 +30,8 @@ install: - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a -# github issue #955: freez build versions of numpy, scipy and matplotlib - - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy=1.19.2 scipy=1.5.2 matplotlib=3.3.4" +# github issue #955: freeze build version of matplotlib + - "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib=%MPL_VERSION%" - activate build-environment # We need wheel installed to build wheels - python -m pip install wheel diff --git a/setup.py b/setup.py index 261a7c908..b79a0d12a 100644 --- a/setup.py +++ b/setup.py @@ -117,13 +117,13 @@ def ismac(): except ModuleNotFoundError: ext_mods = [] -# #955 -install_requirements = ['numpy==1.19.2', 'six', 'paramz>=0.9.0', 'cython>=0.29'] +install_requirements = ['numpy>=1.7', 'six', 'paramz>=0.9.0', 'cython>=0.29'] +matplotlib_version = 'matplotlib==3.3.4' if sys.version_info < (3, 6): install_requirements += ['scipy>=1.3.0,<1.5.0'] + matplotlib_version = 'matplotlib==3.0.0' else: - # #955 - install_requirements += ['scipy==1.5.2'] + install_requirements += ['scipy>=1.3.0'] setup(name = 'GPy', version = __version__, @@ -170,15 +170,14 @@ def ismac(): include_package_data = True, py_modules = ['GPy.__init__'], test_suite = 'GPy.testing', - # #955 - setup_requires = ['numpy == 1.19.2'], + setup_requires = ['numpy>=1.7'], install_requires = install_requirements, extras_require = {'docs':['sphinx'], 'optional':['mpi4py', 'ipython>=4.0.0', ], #matplotlib Version see github issue #955 - 'plotting':['matplotlib == 3.3.4', + 'plotting':[matplotlib_version, 'plotly >= 1.8.6'], 'notebook':['jupyter_client >= 4.0.6', 'ipywidgets >= 4.0.3', From 23aae96152c9a2b530b80613044571cea8549959 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 1 Dec 2021 10:06:01 +0100 Subject: [PATCH 29/33] add: built_from_dict method for White Kernel --- GPy/kern/src/static.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GPy/kern/src/static.py b/GPy/kern/src/static.py index e02513378..a854fe416 100644 --- a/GPy/kern/src/static.py +++ b/GPy/kern/src/static.py @@ -68,6 +68,11 @@ def to_dict(self): input_dict = super(White, self)._save_to_input_dict() input_dict["class"] = "GPy.kern.White" return input_dict + + @staticmethod + def _build_from_input_dict(kernel_class, input_dict): + useGPU = input_dict.pop('useGPU', None) + return White(**input_dict) def K(self, X, X2=None): if X2 is None: From 5c587e91b9a0f185c8caea5abf0e48d7e9220f35 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Tue, 14 Dec 2021 15:08:13 +0100 Subject: [PATCH 30/33] docstring typo fix --- GPy/models/sparse_gp_coregionalized_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/models/sparse_gp_coregionalized_regression.py b/GPy/models/sparse_gp_coregionalized_regression.py index 2a19d52cb..c5a8a6005 100644 --- a/GPy/models/sparse_gp_coregionalized_regression.py +++ b/GPy/models/sparse_gp_coregionalized_regression.py @@ -28,7 +28,7 @@ class SparseGPCoregionalizedRegression(SparseGP): :param name: model name :type name: string - :param W_rank: number tuples of the corregionalization parameters 'W' (see coregionalize kernel documentation) + :param W_rank: number tuples of the coregionalization parameters 'W' (see coregionalize kernel documentation) :type W_rank: integer :param kernel_name: name of the kernel :type kernel_name: string From ebad34a118f5e85b92d42f3b5e72399f9741d43b Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Thu, 23 Dec 2021 09:18:26 +0100 Subject: [PATCH 31/33] to and & from_dict method for periodic kernel --- GPy/kern/src/periodic.py | 25 ++++++++++++++++++++++ GPy/models/gp_coregionalized_regression.py | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/GPy/kern/src/periodic.py b/GPy/kern/src/periodic.py index 3a7a515e3..d97c92341 100644 --- a/GPy/kern/src/periodic.py +++ b/GPy/kern/src/periodic.py @@ -40,6 +40,13 @@ def f(x): return alpha*np.cos(omega*x + phase) return f + def _save_to_input_dict(self): + input_dict = super(Periodic, self)._save_to_input_dict() + input_dict["variance"] = self.variance.values.tolist() + input_dict["lengthscale"] = self.lengthscale.values.tolist() + input_dict["period"] = self.period.values.tolist() + return input_dict + @silence_errors def _cos_factorization(self, alpha, omega, phase): r1 = np.sum(alpha*np.cos(phase),axis=1)[:,None] @@ -200,6 +207,24 @@ def parameters_changed(self): self.G = self.Gram_matrix() self.Gi = np.linalg.inv(self.G) + def to_dict(self): + """ + Convert the object into a json serializable dictionary. + + Note: It uses the private method _save_to_input_dict of the parent. + + :return dict: json serializable dictionary containing the needed information to instantiate the object + """ + + input_dict = super(PeriodicMatern32, self)._save_to_input_dict() + input_dict["class"] = "GPy.kern.PeriodicMatern32" + return input_dict + + @staticmethod + def _build_from_input_dict(kernel_class, input_dict): + useGPU = input_dict.pop('useGPU', None) + return kernel_class(**input_dict) + def Gram_matrix(self): La = np.column_stack((self.a[0]*np.ones((self.n_basis,1)),self.a[1]*self.basis_omega,self.a[2]*self.basis_omega**2)) Lo = np.column_stack((self.basis_omega,self.basis_omega,self.basis_omega)) diff --git a/GPy/models/gp_coregionalized_regression.py b/GPy/models/gp_coregionalized_regression.py index 6604f6348..4662ab419 100644 --- a/GPy/models/gp_coregionalized_regression.py +++ b/GPy/models/gp_coregionalized_regression.py @@ -23,7 +23,7 @@ class GPCoregionalizedRegression(GP): :type likelihoods_list: None | a list GPy.likelihoods :param name: model name :type name: string - :param W_rank: number tuples of the corregionalization parameters 'W' (see coregionalize kernel documentation) + :param W_rank: number tuples of the coregionalization parameters 'W' (see coregionalize kernel documentation) :type W_rank: integer :param kernel_name: name of the kernel :type kernel_name: string From aa9a2ee3600b0fc55f7b39fe8f7ecfa94af2c30a Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 19 Jan 2022 15:15:19 +0100 Subject: [PATCH 32/33] typo fix --- GPy/core/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/core/__init__.py b/GPy/core/__init__.py index 08659add0..8b5226681 100644 --- a/GPy/core/__init__.py +++ b/GPy/core/__init__.py @@ -63,7 +63,7 @@ def randomize(self, rand_gen=None, *args, **kwargs): Make this draw from the prior if one exists, else draw from given random generator :param rand_gen: np random number generator which takes args and kwargs - :param flaot loc: loc parameter for random number generator + :param float loc: loc parameter for random number generator :param float scale: scale parameter for random number generator :param args, kwargs: will be passed through to random number generator """ From f161325f626240a83031f4b8a80579f09513b478 Mon Sep 17 00:00:00 2001 From: gehbiszumeis <16896724+gehbiszumeis@users.noreply.github.com> Date: Wed, 23 Feb 2022 16:19:49 +0100 Subject: [PATCH 33/33] saving W_rank variable in from_dict method for Coregionalization kernels + typo fix --- GPy/kern/src/coregionalize.py | 1 + GPy/util/multioutput.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/GPy/kern/src/coregionalize.py b/GPy/kern/src/coregionalize.py index d05f5c6ad..a5a72bb04 100644 --- a/GPy/kern/src/coregionalize.py +++ b/GPy/kern/src/coregionalize.py @@ -150,6 +150,7 @@ def to_dict(self): input_dict["W"] = self.W.values.tolist() input_dict["kappa"] = self.kappa.values.tolist() input_dict["output_dim"] = self.output_dim + input_dict["rank"] = self.rank return input_dict @staticmethod diff --git a/GPy/util/multioutput.py b/GPy/util/multioutput.py index 912278388..0b1772e28 100644 --- a/GPy/util/multioutput.py +++ b/GPy/util/multioutput.py @@ -75,7 +75,7 @@ def ICM(input_dim, num_outputs, kernel, W_rank=1,W=None,kappa=None,name='ICM'): :num_outputs: Number of outputs :param kernel: kernel that will be multiplied by the coregionalize kernel (matrix B). :type kernel: a GPy kernel - :param W_rank: number tuples of the corregionalization parameters 'W' + :param W_rank: number tuples of the coregionalization parameters 'W' :type W_rank: integer """ if kernel.input_dim != input_dim: