z = sin(x) + 0.5*cos(y) ds.addSample(-2.5, -1) ds.addSample(-1.0, 3) gp.mean = 0 # new feature "autonoise" adds uncertainty to data depending on # it's distance to other points in the dataset. not tested much yet. # gp.autonoise = True gp.trainOnDataset(ds) gp.plotCurves(showSamples=True) # you can also test the gp on single points, but this deletes the # original testing grid. it can be restored with a call to _buildGrid() print(gp.testOnArray(array([[0.4]]))) # --- example on how to use the GP in 2 dimensions ds = SupervisedDataSet(2,1) gp = GaussianProcess(indim=2, start=0, stop=5, step=0.25) figure() x,y = mgrid[0:5:4j, 0:5:4j] z = cos(x)*sin(y) (x, y, z) = list(map(ravel, [x, y, z])) for i,j,k in zip(x, y, z): ds.addSample([i, j], [k])
z = sin(x) + 0.5*cos(y) ds.addSample(-2.5, -1) ds.addSample(-1.0, 3) gp.mean = 0 # new feature "autonoise" adds uncertainty to data depending on # it's distance to other points in the dataset. not tested much yet. # gp.autonoise = True gp.trainOnDataset(ds) gp.plotCurves(showSamples=True) # you can also test the gp on single points, but this deletes the # original testing grid. it can be restored with a call to _buildGrid() print gp.testOnArray(array([[0.4]])) # --- example on how to use the GP in 2 dimensions ds = SupervisedDataSet(2,1) gp = GaussianProcess(indim=2, start=0, stop=5, step=0.25) figure() x,y = mgrid[0:5:4j, 0:5:4j] z = cos(x)*sin(y) (x, y, z) = map(ravel, [x, y, z]) for i,j,k in zip(x, y, z): ds.addSample([i, j], [k])
z = sin(x) + 0.5 * cos(y) ds.addSample(-2.5, -1) ds.addSample(-1.0, 3) gp.mean = 0 # new feature "autonoise" adds uncertainty to data depending on # it's distance to other points in the dataset. not tested much yet. # gp.autonoise = True gp.trainOnDataset(ds) gp.plotCurves(showSamples=True) # you can also test the gp on single points, but this deletes the # original testing grid. it can be restored with a call to _buildGrid() print gp.testOnArray(array([[0.4]])) # --- example on how to use the GP in 2 dimensions ds = SupervisedDataSet(2, 1) gp = GaussianProcess(indim=2, start=0, stop=5, step=0.25) figure() x, y = mgrid[0:5:4j, 0:5:4j] z = cos(x) * sin(y) (x, y, z) = map(ravel, [x, y, z]) for i, j, k in zip(x, y, z): ds.addSample([i, j], [k]) print "preparing plots. this can take a few seconds..."