mwhoffman / pygp

Python package for inference with Gaussian processes
BSD 2-Clause "Simplified" License
11 stars 7 forks source link

SMC.add_data(x, y) breaks when receiving a single data point. #18

Closed bshahr closed 10 years ago

bshahr commented 10 years ago

SMC.add_data(x, y) breaks if x is one-dimensional, because instead of looping over data points it loops over the dimensions of the single data point.

mwhoffman commented 10 years ago

I believe this may have something to do with #11. In fact it has never really been the case that you should be able to add a single data point, it has just sort of worked out... But at least for the case of real kernels we know the dimension and we should be able to fix this problem by fixing #11.

mwhoffman commented 10 years ago

@bshahr Make sure that this is fixed in the newly merged version and close it if so.

bshahr commented 10 years ago

The bug was fixed. For posterity, the problem occurred when running:

import pybo

branin = pybo.models.Branin()
gpei = pybo.GPPolicy(branin.bounds, 
    noise=1e-9,
    kernel='matern5',
    policy='ei',
    inference='smc')

x = gpei.get_init()
y = branin.get(x)
gpei.add_data(x, y)

x = gpei.get_next()
y = branin.get(x)
gpei.add_data(x, y)

The problem arises because gpei.get_next() returns a one dimensional array which SMC.add_data() (inside of gpei.add_data()) loops over. Note that gpei.get_init() does not have that problem because it returns a two dimensional array as it stand. This difference in behaviour (between get_init() and get_next()) may not be desirable. Still, for now the bug is fixed.