def to_dict(self, save_data=True):
input_dict = super(GP, self)._save_to_input_dict()<EOL>input_dict["<STR_LIT:class>"] = "<STR_LIT>"<EOL>if not save_data:<EOL><INDENT>input_dict["<STR_LIT:X>"] = None<EOL>input_dict["<STR_LIT:Y>"] = None<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>input_dict["<STR_LIT:X>"] = self.X.values.tolist()<EOL><DEDENT>except:<EOL><INDENT>input_dict["<STR_LIT:X>"] = self.X.tolist()<EOL><DEDENT>try:<EOL><INDENT>input_dict["<STR_LIT:Y>"] = self.Y.values.tolist()<EOL><DEDENT>except:<EOL><INDENT>input_dict["<STR_LIT:Y>"] = self.Y.tolist()<EOL><DEDENT><DEDENT>input_dict["<STR_LIT>"] = self.kern.to_dict()<EOL>input_dict["<STR_LIT>"] = self.likelihood.to_dict()<EOL>if self.mean_function is not None:<EOL><INDENT>input_dict["<STR_LIT>"] = self.mean_function.to_dict()<EOL><DEDENT>input_dict["<STR_LIT>"] = self.inference_method.to_dict()<EOL>if self.Y_metadata is not None:<EOL><INDENT>input_dict["<STR_LIT>"] = self.Y_metadata<EOL><DEDENT>if self.normalizer is not None:<EOL><INDENT>input_dict["<STR_LIT>"] = self.normalizer.to_dict()<EOL><DEDENT>return input_dict<EOL>
Convert the object into a json serializable dictionary.
Note: It uses the private method _save_to_input_dict of the parent.

:param boolean save_data: if true, it adds the training data self.X and self.Y to the dictionary
:return dict: json serializable dictionary containing the needed information to instantiate the object