retrainSLGP | R Documentation |
This function retrains an existing SLGP model using either a Bayesian MCMC estimation, a Maximum A Posteriori (MAP) estimation, or a Laplace approximation. The model can be retrained using new data, new inference settings, or updated hyperparameters. It reuses the structure and basis functions from the original model.
retrainSLGP(
SLGPmodel,
newdata = NULL,
epsilonStart = NULL,
method,
interpolateBasisFun = "WNN",
nIntegral = 51,
nDiscret = 51,
hyperparams = NULL,
sigmaEstimationMethod = "none",
seed = NULL,
opts = list(),
verbose = FALSE
)
SLGPmodel |
An object of class |
newdata |
Optional data frame containing new observations. If |
epsilonStart |
Optional numeric vector with initial values for the coefficients |
method |
Character string specifying the estimation method: one of {"MCMC", "MAP", "Laplace"}. |
interpolateBasisFun |
Character string specifying how basis functions are evaluated:
|
nIntegral |
Integer specifying the number of quadrature points used to approximate integrals over the response domain. |
nDiscret |
Integer specifying the discretization grid size (used only if interpolation is enabled). |
hyperparams |
Optional list with updated hyperparameters. Must include:
|
sigmaEstimationMethod |
Character string indicating how to estimate |
seed |
Optional integer to set the random seed for reproducibility. |
opts |
Optional list of additional options passed to inference routines:
|
verbose |
Logical; if |
An updated object of class SLGP-class
with retrained coefficients and updated posterior information.
Gautier, A. (2023). Modelling and Predicting Distribution-Valued Fields with Applications to Inversion Under Uncertainty. PhD Thesis, Universität Bern. https://boristheses.unibe.ch/4377/
# Load Boston housing dataset
library(MASS)
data("Boston")
range_x <- c(0, 100)
range_response <- c(0, 50)
#Create a SLGP model but don't fit it
modelPrior <- slgp(medv ~ age, # Use a formula to specify response and covariates
data = Boston, # Use the original Boston housing data
method = "none", # No training
basisFunctionsUsed = "RFF", # Random Fourier Features
sigmaEstimationMethod = "heuristic", # Auto-tune sigma2 (more stable)
predictorsLower = range_x[1], # Lower bound for 'age'
predictorsUpper = range_x[2], # Upper bound for 'age'
responseRange = range_response, # Range for 'medv'
opts_BasisFun = list(nFreq = 200, # Use 200 Fourier features
MatParam = 5/2), # Matern 5/2 kernel
seed = 1) # Reproducibility
#Retrain using the Boston Housing dataset and a Laplace approximation scheme
modelLaplace <- retrainSLGP(SLGPmodel=modelPrior,
newdata = Boston,
method="Laplace")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.