Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: HSGP making wrong out-of-sample predictions when X domain changes #7240

Open
AlexAndorra opened this issue Apr 5, 2024 · 0 comments · May be fixed by #7298
Open

BUG: HSGP making wrong out-of-sample predictions when X domain changes #7240

AlexAndorra opened this issue Apr 5, 2024 · 0 comments · May be fixed by #7298
Assignees
Labels
bug GP Gaussian Process

Comments

@AlexAndorra
Copy link
Contributor

Describe the issue:

While working on the HSGP tutorial with @bwengals, we discovered out-of-sample predictions are wrong when the range of the X domain changes, because L, the parameter on the boundary condition is computed again the new values of X... but shouldn't.
I'll fix that in a PR coming very soon. I'll also make sure the mean-centering of data, necessary to compute L, is done under the hood, instead of requiring the user to do it -- which is the current API but is a sneaky source of error

Reproduceable code example:

x = np.linspace(-5, 5, 100)

with pm.Model() as model:
    # Set mutable data
    X = pm.MutableData("X", x[:, None])

    m = [5]
    c = 5.0

    X_mu = np.mean(x, axis=0)
    Xs = X - X_mu
    
    ### WITH EVAL, NO BUG.  WITHOUT EVAL, BUG
    L = pm.gp.hsgp_approx.set_boundary(Xs, c).eval()
    
    eigvals = pm.gp.hsgp_approx.calc_eigenvalues(L, m, tl=pt)
    phi = pm.gp.hsgp_approx.calc_eigenvectors(Xs, L, eigvals, m, tl=pt)

phi1 = phi.eval()

x_new = np.linspace(-5, 10, 200)

with model:
    pm.set_data({"X": x_new[:, None]})
    
plt.plot(x, phi1, 'k');
plt.plot(x_new, phi.eval(), 'b', alpha=0.5);

Error message:

No response

PyMC version information:

5.12.0

Context for the issue:

No response

@AlexAndorra AlexAndorra added the bug label Apr 5, 2024
@AlexAndorra AlexAndorra self-assigned this Apr 5, 2024
@ricardoV94 ricardoV94 added the GP Gaussian Process label Apr 6, 2024
@AlexAndorra AlexAndorra linked a pull request May 3, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug GP Gaussian Process
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants