# Extracting the posterior mean and covariance from the object created by "GP" in GaussianProcesses.jl

**URL:** <https://discourse.julialang.org/t/extracting-the-posterior-mean-and-covariance-from-the-object-created-by-gp-in-gaussianprocesses-jl/70543>\
**Category:** Optimization (Mathematical)\
**Tags:** gaussian-process\
**Created:** [October 28, 2021, 10:21am UTC](https://discourse.julialang.org/t/extracting-the-posterior-mean-and-covariance-from-the-object-created-by-gp-in-gaussianprocesses-jl/70543 "2021-10-28T10:21:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![path-doc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/path-doc/32/19183_2.png) [@path-doc](https://discourse.julialang.org/u/path-doc)\
**Post date:** [October 28, 2021, 10:21am UTC](https://discourse.julialang.org/t/extracting-the-posterior-mean-and-covariance-from-the-object-created-by-gp-in-gaussianprocesses-jl/70543/1 "2021-10-28T10:21:24Z")

</div>

As part of a broader Value Function Iteration exercise, I wish to feed the output of `predictMVN` or `predict_f` back into an instantiation of `GP`.  
Eg.  
Suppose we have created an instance `gp` by feeding `GP` the usual ingredients: training data `x1`, target data `t1`, along with eg `MeanPoly(B)` and a suitable kernel `kern`.

How do I now extract the posterior mean and covariance from `gp` and, moreover, extract them as `Mean` and `Kernel`?

Or would this question be best posted on the GitHub repository?
