new: added to_dict() method to Coregionalize kernel class

This commit is contained in:
gehbiszumeis 2021-10-27 16:02:58 +02:00
parent 3e19a85575
commit ba050dabfb

View file

@ -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