diff --git a/GPy/core/gp.py b/GPy/core/gp.py index 4bcf1957..5ca86d9e 100644 --- a/GPy/core/gp.py +++ b/GPy/core/gp.py @@ -473,16 +473,16 @@ class GP(Model): self.inference_method.on_optimization_end() raise - def infer_newX(self, Y_new, optimize=True, ): + def infer_newX(self, Y_new, optimize=True): """ - Infer the distribution of X for the new observed data *Y_new*. + Infer X for the new observed data *Y_new*. :param Y_new: the new observed data for inference :type Y_new: numpy.ndarray :param optimize: whether to optimize the location of new X (True by default) :type optimize: boolean :return: a tuple containing the posterior estimation of X and the model that optimize X - :rtype: (:class:`~GPy.core.parameterization.variational.VariationalPosterior` or numpy.ndarray, :class:`~GPy.core.model.Model`) + :rtype: (:class:`~GPy.core.parameterization.variational.VariationalPosterior` and numpy.ndarray, :class:`~GPy.core.model.Model`) """ from ..inference.latent_function_inference.inferenceX import infer_newX return infer_newX(self, Y_new, optimize=optimize) diff --git a/GPy/inference/latent_function_inference/inferenceX.py b/GPy/inference/latent_function_inference/inferenceX.py index a8ed2d09..19013b06 100644 --- a/GPy/inference/latent_function_inference/inferenceX.py +++ b/GPy/inference/latent_function_inference/inferenceX.py @@ -27,12 +27,19 @@ def infer_newX(model, Y_new, optimize=True, init='L2'): class InferenceX(Model): """ - The class for inference of new X with given new Y. (do_test_latent) + The model class for inference of new X with given new Y. (replacing the "do_test_latent" in Bayesian GPLVM) + It is a tiny inference model created from the original GP model. The kernel, likelihood (only Gaussian is supported at the moment) + and posterior distribution are taken from the original model. + For Regression models and GPLVM, a point estimate of the latent variable X will be inferred. + For Bayesian GPLVM, the variational posterior of X will be inferred. + X is inferred through a gradient optimization of the inference model. :param model: the GPy model used in inference :type model: GPy.core.Model :param Y: the new observed data for inference :type Y: numpy.ndarray + :param init: the distance metric of Y for initializing X with the nearest neighbour. + :type init: 'L2', 'NCC' and 'rand' """ def __init__(self, model, Y, name='inferenceX', init='L2'): if np.isnan(Y).any() or getattr(model, 'missing_data', False):