SheffieldML / SheffieldML/GPy

gp models predictive_gradients with mean function

Open
#643 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.2k
Forks
570
PR merge metrics
No merged PRs in 30d

Description

Hi,

I found that when calling predictive_gradients for a gp model with non trivial mean, the gradient returned for mean does not include the contribute of gradient from the mean function. To fix it, I believe simply add the gradient of mean to the result is correct. Here is an example where the I use linear mean function, and gradient of predicted means are about 0.

import numpy as np
import GPy

x_test = np.linspace(-1,1,10).reshape(-1,1)
mf = GPy.mappings.Linear(1,1)
X = np.linspace(-1,1,10).reshape(-1,1)
Y = X
gp_model = GPy.models.GPRegression(X, Y, mean_function=mf)
gp_model.optimize_restarts()
print(gp_model)
print(gp_model.predict(x_test)[0])
print(gp_model.predictive_gradients(x_test)[0])

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Python example and tracing the GP model's predictive_gradients path. Check how the mean function is handled when computing gradients; done means the returned predicted-mean gradients include the contribution from the non-trivial linear mean function and the example no longer reports values near zero.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.