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] 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 d5111c3b..41ddf841 100644 --- a/GPy/kern/src/coregionalize.py +++ b/GPy/kern/src/coregionalize.py @@ -134,3 +134,18 @@ class Coregionalize(Kern): 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