JuliaGaussianProcesses/Stheno.jl

Example Request, simple GP Regression

david-vicente opened this issue · 6 comments

I was not able to understand from the documentation and given examples how to proceed in order to implement a simple regression. For example, using GaussianProcesses.jl I would do:

using Plots, GaussianProcesses

xt =  [-4., -2.5, -1., 0., 2.]
yt = [-2., 0., .1, 2., -1.]

gp = GP(xt,yt, MeanZero(), SE(0.0,0.0))
μ, σ² = predict_y(gp,range(-5, 3, length=100))

plot(gp)

I understand the Stheno is more about composing GPs and other operations, and because of that uses an interface that is very different from the "Scikitlearn" based one that GaussianProcesses.jl adopted, and people are used to.

Thanks

Hi, thanks for the comment. Have you taken a look at the "Fit a GP with NelderMead in 2 Minutes" section of the "Getting Started" bit of the docs?

Using the names in that example, the following would give you posterior marginal distributions:

marginals(f_posterior_ml(x_plot))

so you can pull out e.g. the posterior mean from that.

I managed to do it, thanks!

Fantastic. Is there anything that you feel should be added to the docs?

I might open a pull request adding this example to the examples folder if you don't mind. The docs have all the required information, so probably what I felt had more to do with being learning GPs and at the same time experimenting this new way of thinking used in probabilistic programing (compared to Scikitlearn). So maybe future users in identical situations would benefit from my newcomer perspective.

Absolutely feel free to open PRs to the examples -- more than happy to receive and review them!

Closing this for now. Please feel free to re-open if necessary :)