Skip to content

Latest commit

 

History

121 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deep Compositional Spatial Models

Note: This version uses TensorFlow v2 -- for the original TensorFlow v1 version please download Release 0.2.0

Deep compositional spatial models are standard spatial covariance models coupled with an injective warping function of the spatial domain. The warping function is constructed through a composition of multiple elemental injective functions in a deep-learning framework. The package implements two cases for the univariate setting; first, when these warping functions are known up to some weights that need to be estimated, and, second, when the weights in each layer are random. In the multivariate setting only the former case is available. Estimation and inference is done using TensorFlow, which makes use of graphics processing units.

drawing

Resources

A number of manuscripts explain the theory and methodology behind the deep compositional spatial models in details, see here for the univariate setting, here for the multivariate setting, here for the spatio-temporal setting, and here for the extremes.

An informal blog post summarising the manuscript concerning the univariate setting is available here.

Installation Instructions

This is a guide to install all dependencies (such as tensorflow, keras, tfp) for the package, from a fresh environment.

First, create a virtual environment

## install reticulate first if needed
## install.packages("reticulate")
library(reticulate)
virtualenv_create("r-tensorflow", version = "3.12")

Then, install tensorflow, using the package tensorflow

install.packages("tensorflow")
library(tensorflow)
install_tensorflow(version = "2.18",
                   envname = "r-tensorflow",
                   new_env = FALSE)

Install keras, tfprobability, and scipy

py_install("tensorflow_probability==0.25.0", pip = TRUE)
py_install("tf.keras==2.18.0", pip = TRUE)
py_install("scipy", pip = TRUE)

Then install deepspat

install.packages("deepspat")
library(deepspat)

Check by constructing the warping layers

layers <- c(AWU(r = 50L, dim = 1L, grad = 50, lims = c(-0.5, 0.5)),
            AWU(r = 50L, dim = 2L, grad = 50, lims = c(-0.5, 0.5)),
            RBF_block(),
            LFT())

Reproducible Code

Code using this package for reproducing the results shown in the manuscript describing the univariate setting is available in the supplemental material of our first article. Code for the results shown in manuscript describing the multivariate setting is available here.

About

Deep Compositional Spatial Models

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages