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

1-d infill error estimate #10

Open
achase90 opened this issue Jun 10, 2016 · 5 comments
Open

1-d infill error estimate #10

achase90 opened this issue Jun 10, 2016 · 5 comments

Comments

@achase90
Copy link

I think there might be a bug in the kriging or MSE estimate if the problem is compressed to 2-D (ie, one input and one output). If you run the x*sin(x) test function with only a few points (2-4) and plot the error estimate, it doesn't look correct.

Is the smoothness factor "p" getting optimized on as well as the theta values? If not, that might cause this issue. I believe this bug also exists in the Matlab code, so that won't be a great resource to compare against.

@capaulson
Copy link
Owner

I'll take a look. 1-d arrays weren't really tested during development. I need to add some checks to make sure that the array is at least 2-d. The p factor is optimised in this code. Could you post a quick script to recreate the issue you're seeing with x*sin(x)?

@hchasestevens
Copy link

I've noticed something similar in working with 1-d arrays - please see the code below and resultant output.

import pyKriging
from pyKriging.krige import kriging

MAXVAL = 32
CONVERSION = 0.9687491103216275

X = np.array([[0.01], [1], [2], [8], [16], [32]]) / MAXVAL
y = np.array([
    4.97292791842937,   
    4.84888042822178,   
    4.843428519136497,  
    4.885980222410153,  
    4.952942447020513,  
    5.06074067099633,   
]) * CONVERSION

k = kriging(X, y)
k.train(optimizer='pso')
k.snapshot()

from matplotlib import pyplot as pl
pl.scatter(X * MAXVAL, y, c='black', s=20)
xs = [x / 1000. * MAXVAL for x in xrange(1000)]
k_predictions = [k.predict([x / MAXVAL]) for x in xs]
pl.plot(xs, k_predictions,)
errors = [k.predict_var([x / MAXVAL]) for x in xs]
pl.fill(
    xs + xs[::-1], 
    [pred + err for pred, err in zip(k_predictions, errors)] +
    [pred - err for pred, err in zip(k_predictions, errors)][::-1],
    alpha=.25,
    fc='black'
)
pl.show()

This results in:

Any assistance would be greatly appreciated.

@capaulson
Copy link
Owner

Hi, thanks for the example. I'm looking into this now. It seems to be an error in how the predictions are generated. More to come soon.

Best,
Chris

@achase90
Copy link
Author

achase90 commented Jan 5, 2018

Did you ever figure out what was going on with this?

@hchasestevens
Copy link

Hi @capaulson , just wondering if you ever determined the cause of the issue here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants