xy2unit {spectralGP}R Documentation

Scales locations to the unit hypercube for use in spectral GP

Description

Scales locations to (0,1)^d so that they can be related to the gridpoints in a spectral GP representation. The locations.scale argument allows one to scale the locations to a separate set of locations. E.g., if one wants to predict over a certain set of locations, but has a separate training set of locations that lie within the prediction set, one would use the prediction locations as the locations.scale argument.

Usage

xy2unit(locations, locations.scale = NULL)

Arguments

locations

A two-column matrix-like object (vector for one-dimensional data) of locations to be scaled.

locations.scale

A two-column matrix-like object (vector for one-dimensional data) of locations that provides the function with the min and max coordinates in each direction.

Details

One may want to use both training and prediction locations as the locations.scale argument to ensure that all locations of interest will lie in (0,1)^d and be able to be related to the gridpoints.

Value

A matrix (vector for one-dimensional data) of scaled locations lying in (0,1)^d.

Author(s)

Christopher Paciorek paciorek@alumni.cmu.edu

References

Type 'citation("spectralGP")' for references.

See Also

gp, new.mapping

Examples

library(spectralGP)
gp1=gp(c(128,128),matern.specdens,c(1,4))
n=100
locs=cbind(runif(n,0.2,1.2),runif(n,-0.2,1.4))
locs.predict=cbind(runif(n,-0.4,0.8),runif(n,-0.1,1.7))
scaled.locs=xy2unit(locs,rbind(locs,locs.predict))
scaled.locs.predict=xy2unit(locs.predict,rbind(locs,locs.predict))
train.map=new.mapping(gp1,scaled.locs)
predict.map=new.mapping(gp1,scaled.locs.predict)
plot(locs,xlim=c(min(locs[,1],locs.predict[,1]),max(locs[,1],
  locs.predict[,1])),ylim=c(min(locs[,2],locs.predict[,2]),
  max(locs[,2],locs.predict[,2])))
points(locs.predict,col=2)
plot(scaled.locs,xlim=c(0,1),ylim=c(0,1))
points(scaled.locs.predict,col=2)

[Package spectralGP version 1.3.3 Index]