Learn R Programming

deepspat (version 0.3.1)

deepspat_GP: Deep compositional spatial model for Gaussian processes

Description

Constructs a deep compositional spatial model

Usage

deepspat_GP(
  f,
  data,
  g = ~1,
  layers = NULL,
  method = c("REML"),
  family = c("exp_stat", "exp_nonstat", "matern_stat", "matern_nonstat"),
  par_init = initvars(),
  learn_rates = init_learn_rates(),
  nsteps = 150L
)

Value

deepspat_GP returns an object of class deepspat_GP with the following items

"f"

The formula used to construct the covariance model

"g"

The formula used to construct the linear trend model

"data"

The data used to construct the deepspat model

"X"

The model matrix of the linear trend

"layers"

The warping function layers in the model

"Cost"

The final value of the cost

"eta_tf"

Estimated weights in the warping layers as a list of TensorFlow objects

"a_tf"

Estimated parameters in the LFT layers

"beta"

Estimated coefficients of the linear trend

"precy_tf"

Precision of measurement error, as a TensorFlow object

"sigma2_tf"

Variance parameter in the covariance matrix, as a TensorFlow object

"l_tf"

Length scale parameter in the covariance matrix, as a TensorFlow object

"nu_tf"

Smoothness parameter in the covariance matrix, as a TensorFlow object

"scalings"

Minima and maxima used to scale the unscaled unit outputs for each warping layer, as a list of TensorFlow objects

"method"

Method used for inference

"nlayers"

Number of warping layers in the model

"swarped_tf"

Spatial locations on the warped domain

"negcost"

Vector of costs after each gradient-descent evaluation

"z_tf"

Data of the process

"family"

Family of the model

Arguments

f

formula identifying the dependent variables and the spatial inputs in the covariance

data

data frame containing the required data

g

formula identifying the independent variables in the linear trend

layers

list containing the nonstationary warping layers

method

identifying the method for finding the estimates

family

identifying the family of the model constructed

par_init

list of initial parameter values. Call the function initvars() to see the structure of the list

learn_rates

learning rates for the various quantities in the model. Call the function init_learn_rates() to see the structure of the list

nsteps

number of steps when doing gradient descent times two or three (depending on the family of model)

Examples

Run this code
# \donttest{
if (reticulate::py_module_available("tensorflow")) {
df <- data.frame(s1 = rnorm(100), s2 = rnorm(100), z = rnorm(100))
layers <- c(AWU(r = 50L, dim = 1L, grad = 200, lims = c(-0.5, 0.5)),
            AWU(r = 50L, dim = 2L, grad = 200, lims = c(-0.5, 0.5)))
d <- deepspat_GP(f = z ~ s1 + s2 - 1,
                 data = df, g = ~ 1,
                 layers = layers, method = "REML",
                 family = "matern_nonstat",
                 nsteps = 10L)
 }
# }

Run the code above in your browser using DataLab