MCPcopy
hub / github.com/GPflow/GPflow / predict_y

Method predict_y

gpflow/models/model.py:290–325  ·  view source on GitHub ↗

r""" Compute the mean and variance of the held-out data at the input points. Given $x_i$ this computes $y_i$, for: .. math:: :nowrap: \begin{align} \theta & \sim p(\theta) \\ f & \sim \mathcal{GP}(m(x),

(
        self, Xnew: InputData, full_cov: bool = False, full_output_cov: bool = False
    )

Source from the content-addressed store, hash-verified

288 "return[1]: [batch..., N, P] if (not full_cov) and (not full_output_cov)",
289 )
290 def predict_y(
291 self, Xnew: InputData, full_cov: bool = False, full_output_cov: bool = False
292 ) -> MeanAndVariance:
293 r"""
294 Compute the mean and variance of the held-out data at the input points.
295
296 Given $x_i$ this computes $y_i$, for:
297
298 .. math::
299 :nowrap:
300
301 \begin{align}
302 \theta & \sim p(\theta) \\
303 f & \sim \mathcal{GP}(m(x), k(x, x'; \theta)) \\
304 f_i & = f(x_i) \\
305 y_i \,|\, f_i & \sim p(y_i|f_i)
306 \end{align}
307
308
309 For an example of how to use ``predict_y``, see
310 :doc:`../../../../notebooks/getting_started/basic_usage`.
311
312 :param Xnew:
313 Input locations at which to compute mean and variance.
314 :param full_cov:
315 If ``True``, compute the full covariance between the inputs.
316 If ``False``, only returns the point-wise variance.
317 :param full_output_cov:
318 If ``True``, compute the full covariance between the outputs.
319 If ``False``, assumes outputs are independent.
320 """
321 # See https://github.com/GPflow/GPflow/issues/1461
322 assert_params_false(self.predict_y, full_cov=full_cov, full_output_cov=full_output_cov)
323
324 f_mean, f_var = self.predict_f(Xnew, full_cov=full_cov, full_output_cov=full_output_cov)
325 return self.likelihood.predict_mean_and_var(Xnew, f_mean, f_var)
326
327 @check_shapes(
328 "data[0]: [batch..., N, D]",

Callers

nothing calls this directly

Calls 3

predict_fMethod · 0.95
assert_params_falseFunction · 0.85
predict_mean_and_varMethod · 0.80

Tested by

no test coverage detected