From 1753b89334ed72536f7d73d637733797b27493b9 Mon Sep 17 00:00:00 2001 From: Max Zwiessele Date: Mon, 4 Apr 2016 10:24:44 +0100 Subject: [PATCH] [magnification] prediction now accepts dimensions --- GPy/core/gp.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/GPy/core/gp.py b/GPy/core/gp.py index c2e67338..0701935b 100644 --- a/GPy/core/gp.py +++ b/GPy/core/gp.py @@ -437,15 +437,22 @@ class GP(Model): warnings.warn("Wrong naming, use predict_wishart_embedding instead. Will be removed in future versions!", DeprecationWarning) return self.predict_wishart_embedding(Xnew, kern, mean, covariance) - def predict_magnification(self, Xnew, kern=None, mean=True, covariance=True): + def predict_magnification(self, Xnew, kern=None, mean=True, covariance=True, dimensions=None): """ Predict the magnification factor as sqrt(det(G)) - for each point N in Xnew + for each point N in Xnew. + + :param bool mean: whether to include the mean of the wishart embedding. + :param bool covariance: whether to include the covariance of the wishart embedding. + :param array-like dimensions: which dimensions of the input space to use [defaults to self.get_most_significant_input_dimensions()[:2]] """ G = self.predict_wishard_embedding(Xnew, kern, mean, covariance) + if dimensions is None: + dimensions = self.get_most_significant_input_dimensions()[:2] + G = G[:, dimensions][:,:,dimensions] from ..util.linalg import jitchol mag = np.empty(Xnew.shape[0]) for n in range(Xnew.shape[0]):