Git Product home page Git Product logo

gplite's Introduction

gplite

An R package for fitting some of the most common Gaussian process (GP) models. Implements Laplace and EP approximations for handling non-Gaussian observation models, performs hyperparameter optimization using maximum marginal likelihood (or posterior), and implements some common sparse approximations for handling larger datasets. Provides also tools for model assessment and comparison via leave-one-out (LOO) cross-validation.

The syntax has taken a lot of inspiration from that of GPstuff but the intention of the package is not to be a GPstuff clone for R.

Resources

Installation

  • Install the latest release from CRAN
install.packages('gplite')
  • To install the latest development version from GitHub, use the following commands (requires devtools package):
if (!require(devtools)) {
  install.packages("devtools")
  library(devtools)
}
devtools::install_github('jpiironen/gplite', build_vignettes = TRUE)

Example

library(gplite)
library(ggplot2)

# create some toy 1d regression data
set.seed(32004)
n <- 200
sigma <- 0.1
x <- rnorm(n)
y <- sin(3*x)*exp(-abs(x)) +  rnorm(n)*sigma

# set up the gp model, and optimize the hyperparameters
gp <- gp_init(cfs = cf_sexp(), lik = lik_gaussian())
gp <- gp_optim(gp, x, y)

# compute the predictive mean and variance in a grid of points
xt <- seq(-4, 4, len=300)
pred <- gp_pred(gp, xt, var=T)

# visualize
mu <- pred$mean
lb <- pred$mean - 2*sqrt(pred$var)
ub <- pred$mean + 2*sqrt(pred$var)
ggplot() +
  geom_ribbon(aes(x=xt, ymin=lb, ymax=ub), fill='lightgray') +
  geom_line(aes(x=xt, y=mu), size=1) +
  geom_point(aes(x=x, y=y), size=0.5) +
  xlab('x') + ylab('y')

Citing

If you find the software useful, please use the following citation:

Piironen, Juho (2021). gplite: General Purpose Gaussian Process Modelling. R package.

Bibtex:

@misc{gplite,
  author = {Piironen, Juho},
  title = {gplite: General Purpose {G}aussian Process Modelling},
  note = {R package},
  year = {2021},
  url = {https://github.com/jpiironen/gplite},
}

References

Rasmussen, C. E. and Williams, C. K. I. (2006). Gaussian processes for machine learning. MIT Press. Online

gplite's People

Contributors

jpiironen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

delimited0

gplite's Issues

Keep an indicator for convergence

I don't see anywhere where the convergence results are stored. If we want to compute against this, we would have to handle the warning and pattern match the text for the appropriate message.

covariance parameter extraction and updating

I'm thinking about using gplite for the Bayesian optimization done in the tune package. I'd like to pass in starting parameters since we run repeated GPs based in incremental updates to the data. My initial testing indicates that, for this application, taking a median or trimmed mean of the previous parameters is very helpful.

The issue is that it is difficult to know the parameter values for the covariance function (programmatically). I'd like to extract them per iteration but that might be difficult when there are compound covariance functions.

Can you make something like an extract_parameters function that could return a data frame of the parameters and their associated covariance function? An update method would also be nice.

For the example in the vignette, maybe something like this:

cf0 <- cf_const(magn = 5)
cf1 <- cf_lin(magn = 0.01)
cf2 <- cf_periodic(
  period = 12, 
  prior_period = prior_fixed(),
) * cf_sexp(
  lscale = 100,
  magn = 1, 
  prior_magn = prior_fixed()
)
cfs <- list(cf0, cf1, cf2)

data.frame(
  parameter = c("magn", "magn", "lscale", "magn"),
  value = c(5, 0.01, 100, 1),
  source = c("cf_const", "cf_lin", "cf_periodic", "cf_periodic"),
  index = c(1, 1, 2, 2)
)

or something similar to make them identifiable and updatable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.